Fix bug in term-cycle