fixed an issue in the tree builder