improve postgres installation, make it more resilient to errors