Fixes issue with concurrent modification with remove all.