implemented deepCopy for HeapObjects