Fixing ConcurrentModificationException in some instances in Java language support