Fix "next" to handle zero case