Fix incorrect use of copy on list
Merge pull request #6248 from hkariti/fix_list_copy

Fix incorrect use of copy() on list, causing a traceback