Fix segfault when dealing with chan_agent channels.