             [salava.core.i18n :refer [t]]))
 
 (defn email-options [state]
-  (map #(hash-map :value % :title %) (:emails @state)))
+  (map #(hash-map :value % :title %) (map #(:email %) (:emails @state))))
 
 (defn visibility-options []
   [{:value "all" :title (t :badge/All)}

  (ajax/GET
    (path-for "/obpv1/badge/export" true)
    {:handler (fn [{:keys [badges emails]} data]
                (let [exportable-badges (filter #(some (fn [e] (= e (:email %))) emails) badges)]
                  (swap! state assoc :badges exportable-badges :emails emails :email-selected (first emails) :initializing false :permission "success")))}
    (fn [] (swap! state assoc :permission "error"))))

(defn handler [site-navi]

           [:button {:class    "btn btn-primary"
                     :on-click #(select-all state)}
            (if (:badges-all @state) (t :badge/Clearall) (t :badge/Selectall))]
           (if (not (nil? (:backpack_id (first (filter #(= (:email %) (:email-selected @state)) (:emails @state))))))
             [:button {:class    "btn btn-primary"
                       :on-click #(export-badges state)
                       :disabled (= 0 (count (:badges-selected @state)))}
              (t :badge/Exportselected)])
           [:button {:class "btn btn-primary"
                     :on-click #(do (.preventDefault %)
                                     (swap! state assoc :pdf-option "default")
