fix potential ConcurrentModificationException