fixed a mistake in Loop line 543, generation is i