made the monitor thread significantly more robust