fix crash when trying to sort multiple-channels matrix