Fixed monitor_leave bug