Fix a crash when parsing events