Fix group creation in the tree generator