fixed bug in tree.h