minor fixes to matrix_sort.h