Config, database and other fixes

It is starting without error so far but not bug free.