fix bug in previous and next processes