Bug fix-- can't expect iterator to be valid after erase. Fixes mac segfault.