Fix a crasher bug where I was accessing an invalidated iterator