fix semantics of next and prev