add unit test for event, fix some thing