added synchronized
foreach method