Fix invalid use of "next()"

I think this is what was originally intended.