Fixed off-by-one error in nextSlot() and prevSlot()