fixed bug that was introduced when switching to arrays of event code