fix monitor exception handling.
Fix state variables.