fix next and prev values