fixed bug where jobs could not be dequeued inside a running event loop