Fixed bug in event publishing