Sorting bug fixed