fix errors on postgres