Fixed a bug in the foreach method of ListenerSet where listeners were
not called when listeners removed themselfs from the set during their
execution.