Fix crashing caused by collection state inconsistency.