Fixed a logic error in the monitor script.