Fixed a location sorting bug that crashed the application.