fixed bug where events were not logged correctly