fix 2to3 issues with local next variable