Updated master.py to fix write over condition.