           cb (CharBuffer/allocate (alength b))]
       (loop []
         (when (.hasRemaining bb)
-          (.put cb (char (+ 33 (.get bb))))
+          (.put cb (phred-byte->fastq-char (.get bb)))
           (recur)))
       (.flip cb)
       (.toString cb))))


;;; fastq and phred

(defn fastq-char->phred-byte [ch]
  [ch]
  {:pre [(<= 33 (int ch) 126)]}
  (byte (- (int ch) 33)))

(defn fastq->phred ^bytes [^String fastq]
  (let [b (.getBytes fastq)
        in-bb (ByteBuffer/wrap b)
        out-bb (ByteBuffer/allocate (alength b))]
    (while (.hasRemaining in-bb)
      (.put out-bb (byte (- (int (.get in-bb)) 33))))
    (.array out-bb)))

(defmulti phred->fastq class)

(defmethod phred->fastq Integer
  [n]
  {:pre [(<= 0 n max-phred-score)]}
  (phred-byte->fastq-char n))

;;; Reference functions

