Corrected behavior for prevId and nextId