Fixed a bug with the number of events