Fixed detection of infinite recursion.