fix location sorting