Fixed some bugs in config and event