implemented threadsafe EventQueue
Fixed bug in reactor.