eliminate two hash accesses per node when detecting recursion