added error handling for location services