Fixed tree generation issue