I thought the channel names were already sorted in the source data file, but it turns out they aren't. I now sort them after sorting the category names.