Update monitor.py

Reverse the lines with _margin so when the margin is None it return default value