Fixed postgres errors