Bug fixes in the monitor script.