made remove leaf and replace with copy