Improvements to database startup logic