fix bug when reading events