avoid concurrent modification exceptions in edge cases by using copy of synchronizations

(cherry picked from commit b7d0efb73f93ca9e50fe17eb3e1c229c81141600)