seems like there is a bug here. `ii` is not defined yet.