Fix cycle-to-same-length bug