fix sorting order in MemSortAndDedup.scala