added better if statement at stop_mouseevents