modify next and previous