Local iterator do not affect global variable