replace shallow cloning with deep clone for complex data types