implement event queue, fix #3