fix some bugs

improve event dispatcher