Fix duplication of nodes.

- Old implementation, only copied the tree node, and this duplicated
  treenode pointed to the same data node. That could never have worked.