Jonas' fix for a memory leak when detector events are damaged