Fix bugs in tree interator classes, add tree.hh to build sys