fix error in allocating event size