fix tree bugs