Fix a stack overflow occuring for cyclic hyperedges.