Fixed a small bug in closest portal lookup