fix recursion in walk tree