fixed undeclared event bug