fixed bug in monitor script