Fixed bug in copy logic