     (complete [^ConsoleReader reader ^java.util.List candidates pos]
       (let [buf (.getCursorBuffer reader)]
         (if (= 1 (.size candidates))
-          (let [value (:candidate (.get candidates 0))]
+          (let [value (.get candidates 0)]
             (if (= value (.toString buf))
               false
               (do (CandidateListCompletionHandler/setBuffer

              (CandidateListCompletionHandler/setBuffer
                reader
                (completion/get-unambiguous-completion
                  (map :candidate candidates))
                pos))
            (CandidateListCompletionHandler/printCandidates
              reader
              (map :candidate candidates))
            (.redrawLine reader)
            true))))))


      (let [buffer (or buffer "")
            prefix (or (completion/get-word-ending-at buffer cursor) "")
            prefix-length (.length prefix)
            possible-completions (completion/get-candidates completions prefix)]
        (if (or (empty? possible-completions) (zero? prefix-length))
          -1
          (do
            (.addAll candidates possible-completions)
            (- cursor prefix-length)))))))

(defn make-var-completer [ns]
  (let [collections (concat (map keys ((juxt ns-publics
                                             ns-refers
                                             ns-imports)
                                       ns))
                            [(map str (all-ns))])]
    (make-completer
      (mapcat (comp sort (partial map str))
