         eventDispatcher = DefaultEventDispatcher( backingStore: .file)
         let pEventD:OPTEventDispatcher = eventDispatcher!
         eventDispatcher?.timerInterval = 1
-        let group = DispatchGroup()
-        let enter = { () in
-            group.enter()
-        }
         let wait = {() in
-            self.eventDispatcher?.dispatcher.async {
-                group.leave()
-            }
-            
-            group.wait()
-        }
-
-        enter()
-        
-        pEventD.flushEvents()
-        
-        wait()
-        
-        enter()
-        
-        pEventD.dispatchEvent(event: EventForDispatch(body: Data())) { (result) -> (Void) in
-            
-        }
-
-        wait()
-        
-        XCTAssert(eventDispatcher?.dataStore.count == 1)
-        
-        enter()
-        
-        eventDispatcher?.flushEvents()
-        
+            self.eventDispatcher?.dispatcher.sync {
+            }
+        }
+
+        pEventD.flushEvents()
+        wait()
+        
+        pEventD.dispatchEvent(event: EventForDispatch(body: Data())) { (result) -> (Void) in
+            
+        }
+        wait()
+        
+        XCTAssert(eventDispatcher?.dataStore.count == 1)
+        
+        eventDispatcher?.flushEvents()
         wait()
         
         XCTAssert(eventDispatcher?.dataStore.count == 0)

        group.wait()
        XCTAssert(sent)
        
        eventDispatcher?.setTimer()
        
        sleep(4)
        
        // we are on the main thread and set timer on async main thread
        // so, must be nil here

        eventDispatcher = DefaultEventDispatcher( backingStore: .memory)
        let pEventD:OPTEventDispatcher = eventDispatcher!
        eventDispatcher?.timerInterval = 1
        let wait = {() in
            self.eventDispatcher?.dispatcher.sync {
            }
        }

        pEventD.flushEvents()
        wait()
        
        pEventD.dispatchEvent(event: EventForDispatch(body: Data())) { (result) -> (Void) in
        }
        wait()
        
        XCTAssert(eventDispatcher?.dataStore.count == 1)
        
        eventDispatcher?.flushEvents()
        wait()
        
        XCTAssert(eventDispatcher?.dataStore.count == 0)
