Updated master.py to fix mode switching bugs.