Fix tree walk bug