added error handling for geolocation and fixed incorrect variable name