fixes for pgsql