added function copyObj