Another invalid iterator fix