Fix more postgres errors as pointed out by johnsojc