Fix iterator erase() problems