mostly pg fixes
merge