Fix for the recursive contruction of the tree.