Need to use deepcopy()

Fixes #8610.