fixes to lexsort