path_to_location: fix case when a string location is passed