fix postgres access bug