Fixed inverted prevnext logic.