Added check for DB existence