still some problem with tree generation