Fix tree template intergration bug