fixed shallow copy/deep copy issue when instantiating objects