fix #138 collection mutated while being enumerated exception

This fixes the collection mutated while being enumerated exception. 

#138