Fix error when sorting the last survey