fix bug in copy