Added more error checking to location loading.