fix for java ConcurentModification exception