Move user_db inside if statement