i iterator not being updated correctly, fixed