sorted out psql mess