Add postgresql setup and other small bugfixes