fix leave_handler