some fixes for postgresql.