Places db_stop at the correct place inside the if statement.