Fix Query Sorting