Fix return undefined problem
Fix async and sync event dispatch problem