Move cancel_timer to the right place