         guard let users = try? Realm().objects(User.self) else { return }
         
         if prefix == "@" && word.characters.count > 0 {
-            self.searchResult = users.filter(NSPredicate(format: "username BEGINSWITH[c] %@", word))
-        }
-        
-        let show = (self.searchResult?.count ?? 0 > 0)
+            self.searchResult = users.filter(NSPredicate(format: "username BEGINSWITH[c] %@", word)).map({ $0.username ?? "" })
+        }
+        
+        let show = (self.searchResult.count > 0)
         self.showAutoCompletionView(show)
     }
     
     override func heightForAutoCompletionView() -> CGFloat {
-        return AutocompleteCell.minimumHeight * CGFloat(searchResult?.count ?? 1)
+        return AutocompleteCell.minimumHeight * CGFloat(searchResult.count)
     }
     
     override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return searchResult?.count ?? 0
+        return searchResult.count
     }
     
     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    weak var chatTitleView: ChatTitleView?
    weak var chatPreviewModeView: ChatPreviewModeView?
    
    var searchResult: Results<User>?
    var messagesToken: NotificationToken!
    var messages: Results<Message>!
    var subscription: Subscription! {

    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let object = searchResult[indexPath.row]
        acceptAutoCompletion(with: object, keepPrefix: true)
    }
    
    func autoCompletionCellForRowAtIndexPath(_ indexPath: IndexPath) -> AutocompleteCell {
        let object = searchResult[indexPath.row]
        let cell = autoCompletionView.dequeueReusableCell(withIdentifier: AutocompleteCell.identifier) as! AutocompleteCell
        cell.selectionStyle = .default
        
        // cell.avatarView.user = user
        cell.labelTitle.text = object
        return cell
    }
    
