Fixes postgres errors