fixed some problem with remaining iterator i