Fixed deep copy issues