Fix error when the callbacks array changes size while processing an event.

If I have an event which happens to remove a group it is included in,
things broke.