Fixed bunch of issues with main.db server startup.