fixes for autostart database and the order of startup