fixed bug with event dispatching thread