Replace unneccessary deepcopies with copies.