Fixed default database handling, closes #574