add check for existing database directory