minor error fix when events is undefined

* Sometimes (specifically locally), events comes out undefined; this
  fixes that and doesn't make me look into why that happens.