fix tree builder