fixed the crash issue when the monitor service stop