Fix iterator invalidation issues.
Fix iterator invalidation issues.

krafczyk/spack,lgarren/spack,matthiasdiener/spack,iulian787/spack,EmreAtes/spack,skosukhin/spack,krafczyk/spack,tmerrick1/spack,tmerrick1/spack,skosukhin/spack,iulian787/spack,LLNL/spack,iulian787/spack,EmreAtes/spack,TheTimmy/spack,lgarren/spack,lgarren/spack,LLNL/spack,mfherbst/spack,skosukhin/spack,TheTimmy/spack,mfherbst/spack,krafczyk/spack,LLNL/spack,LLNL/spack,tmerrick1/spack,lgarren/spack,lgarren/spack,tmerrick1/spack,matthiasdiener/spack,matthiasdiener/spack,skosukhin/spack,iulian787/spack,mfherbst/spack,EmreAtes/spack,iulian787/spack,TheTimmy/spack,krafczyk/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,EmreAtes/spack,matthiasdiener/spack,EmreAtes/spack,TheTimmy/spack,mfherbst/spack,TheTimmy/spack,tmerrick1/spack,matthiasdiener/spack,skosukhin/spack