update prev and next