fixes to 'isRecursive' algorithm