                     self.result.selectedWords = NSSpellChecker.shared.countWords(in: String(selectedString), language: self.language)
                 }
             }
+            dispatchGroup.wait()
         }
         
         // calculate current location

                self.result.unicode = selectedString.unicodeScalars.first?.codePoint
            }
        }
        
        // wait word count on the main thread
        dispatchGroup.wait()
    }
    
}

        guard !self.isCancelled else { return }
        
        // count words
        if self.requiredInfo.contains(.words) {
            // perform on the main thraed to use shared NSSpellChecker (macOS 10.14)
            let dispatchGroup = DispatchGroup()
            dispatchGroup.enter()
            DispatchQueue.main.async { [weak self] in
                defer { dispatchGroup.leave() }
