Fix bugs in tree support.

Previous version will count parent node as well as leaf node, making the support
 a bit larger.