Improve sorter tests
Fix #276 #330 improve sorter_rank behavior