Add the new function to copy objects  & fix bug