fixed bug when inserting with iterator