Fix for nodes with undefined parent

This pervents the tree initialisation from crashing if a node has a parent defined that is not present in the tree.

Let me know if you need a use case or more details.

Thanks!