Added synchronized block to prevent ConcurrentModificationException
happening on startup