some code fixes in the monitor loop.