Fixed TreeBuilder.

Added debug output of tree structure.