remove use of deepcopy from alg3