fixed invalid iterator