Fix a TypeError: 'tuple' object does not support item assignment