Fixed minor bugs for Postgres