- fixed sorter function