 (defn do-reduce-count [#^Model model #^Collection values #^Metadata tgt-metadata count-key]
   (let [strategy (make-count-reducer-strategy (.getMetadata model) tgt-metadata)
 	view-name-fn (fn [arg] "count()")]
-    (make-reducer model count-key values strategy tgt-metadata view-name-fn)))
+    (make-reducer (.getName model) count-key values strategy tgt-metadata view-name-fn)))
 
 ;;----------------------------------------
 ;; refactored to here

;;----------------------------------------

(defn make-reducer
  [#^Model src-model #^Object key-key #^Collection key-values #^Reducer$Strategy strategy #^Metadata tgt-metadata name-fn]
  ;;[#^Model src-model #^Collection key-keys #^Collection key-values #^Reducer$Strategy strategy #^Metadata tgt-metadata name-fn]
  (let [key-keys (Tuple. key-key)
	key-name (apply str (interpose "," key-keys))
	view-name (str (.getName src-model) "." (name-fn key-name))]
    (Reducer. view-name tgt-metadata key-values strategy)))

;; sum specific stuff - should be in its own file

  ([#^Model model #^Keyword attribute-key attribute-type attribute-value #^Metadata tgt-metadata]
   (let [strategy (make-sum-reducer-strategy attribute-key (.getMetadata model) tgt-metadata)
	 view-name-fn #(str "sum(" % ")")
	 reducer (make-reducer (.getName model) attribute-key [attribute-value] strategy tgt-metadata view-name-fn)]
     (connect model reducer)))
  )

