Fixed bug with postgres access