Duplicated Tree Unflatten per grafted branch

It’s not sufficient, attach a minimal file of your problem, internalize needed values and delete the rest like David shows in the linked topic.

Additionally my wild guess is that this:

is not necessary, but hard to say without a file.