Better erasing from the map during the iteration. Now it should work!