Fix global leak of variable `ii`