Fix the sort statement