Fixes next/previous logic (off by one, and missing cursor set).