list.append() changes the original list. Fixed by using 'deepcopy' of the original list.