fixed tree builder bug