Fixed Sorting bug