fix cycle bug in previous and next processes