fix bug - publishEvent not defined