Fix bug when a channel is empty.

This is to fix #182.