core: workaround for very rare ConcurrentModificationException