Function get_location fixed