Fixed a mistake where the first instead of the closest location is returned.