Fixes cycling algorithm.