Added accurate cycle detection.

[Delivers #57445434]