Update monitor.py

Reverse the lines with _margin. When the margin is None it return default value