Fixed the cycle bug.