refactor events, fix #2