          (if show-modal?
            (let [users (remove :circle_member (:vcs-users selected-org))
                  count-users (count users)
-                 count-with-email (count (filter (comp utils/valid-email? :email last) org-members-by-login))
-                 count-selected (count (filter (comp :selected last) org-members-by-login))]
+                 count-with-email (count (filter (fn [[_ user]]
+                                                   (-> user :email valid-email?))
+                                                 org-members-by-login))
+                 count-selected (count (filter (fn [[_ user]]
+                                                 (:selected user))
+                                               org-members-by-login))]
              (modal/modal-dialog {:title "Invite Teammates"
                                   :body
                                   (element :body

                      (:email user))))))

(defn invite-teammates-modal [{:keys [selected-org close-fn show-modal?]} owner]
  (let [select-user! (fn [{:keys [login] :as user}]
                       (om/set-state! owner [:org-members-by-login login :selected] true))
        deselect-user! (fn [{:keys [login] :as user}]
                         (om/set-state! owner [:org-members-by-login login :selected] false))
        selected? (fn [{:keys [login] :as user}]
                    (om/get-state owner [:org-members-by-login login :selected]))
        set-email! (fn [{:keys [login] :as user} value]
                       (om/set-state! owner [:org-members-by-login login :email] value))
        get-email (fn [{:keys [login] :as user}]
                    (om/get-state owner [:org-members-by-login login :email]))]
    (reify
      om/IWillReceiveProps
      (will-receive-props [_ new-props]

            (om/set-state! owner
                           :org-members-by-login
                           (into {}
                                 (for [{:keys [login circle_member email id]
                                        :as user} new-vcs-users
                                       :when (not circle_member)
                                       :let [trimmed-email (some-> email gstr/trim)]]
                                   [login {:email trimmed-email
                                           :login login
                                           :id id
                                           :selected (valid-email? trimmed-email)}]))))))
      
      om/IRenderState
      (render-state [_ {:keys [org-members-by-login]}]
