fix unittest and event bug