Improved the robustness of the cyclic detection algorithm. #78