Fixes ConcurrentModificationException in State#resolveMetricReferences.