Fix Python 3 dictionary mutation