Add fixes for pg database