Fixes for postgres