Merge anthm's monitor patch with minor mods (bug #2383)