adding validation code to AGREE to check for recursion between functions and node calls