Fixed checkDatabase() function from running twice.