Fixing a concurrent modification error.

This addresses issue #408.