Add synchronization to avoid concurrent modification exception