Fix buffer sorting.

Bug introduced in 4ef6e889b8f1c1bc0edabfa3d922d13b48148e43
Merge pull request #11 from Zren/channelsortfix

Fix buffer sorting.