fixed a few postgres related errors