fixed postgres errors