Fixed issues with object copying