fix bug with copying