make sure the number of events is serialized as an int