Replace second deepcopy in task.py.