fix geolocation function