Fix bug throwing exception when first event is collected