php 5.2 compatibility fixes, and pgsql related bugfixes