Fix ambiguity warnings on julia 0.4
Replace deepcopy with explicit copy