Fix next and previous session functions to actually work.