tree parsing correctly