Debug the sort function.