fixed pg connect logic in Locations