diff --git a/som.cabal b/som.cabal
--- a/som.cabal
+++ b/som.cabal
@@ -1,5 +1,5 @@
 name:           som
-version:        7.2.0
+version:        7.2.1
 synopsis:       Self-Organising Maps
 description:    A Kohonen Self-organising Map (SOM) maps input patterns 
                 onto a regular grid (usually two-dimensional) where each
diff --git a/src/Data/Datamining/Clustering/Classifier.hs b/src/Data/Datamining/Clustering/Classifier.hs
--- a/src/Data/Datamining/Clustering/Classifier.hs
+++ b/src/Data/Datamining/Clustering/Classifier.hs
@@ -40,7 +40,9 @@
   -- | @classify c target@ returns the index of the node in @c@ 
   --   whose model best matches the @target@.
   classify :: (Pattern p, Ord v, v ~ Metric p) => c k p -> p -> k
-  classify c p = fst . minimumBy (comparing snd) $ differences c p
+  classify c p = f $ differences c p
+    where f [] = error "classifier has no models"
+          f xs = fst $ minimumBy (comparing snd) xs
 
   -- | @'train' c target@ returns a modified copy
   --   of the classifier @c@ that has partially learned the @target@.
diff --git a/src/Data/Datamining/Clustering/DSOMInternal.hs b/src/Data/Datamining/Clustering/DSOMInternal.hs
--- a/src/Data/Datamining/Clustering/DSOMInternal.hs
+++ b/src/Data/Datamining/Clustering/DSOMInternal.hs
@@ -115,7 +115,9 @@
      DSOM gm t p -> p -> DSOM gm (G.Index (gm p)) p
 justTrain s p = trainNeighbourhood s bmu p
   where ds = GM.toList . GM.map (p `difference`) $ sGridMap s
-        bmu = fst $ minimumBy (comparing snd) ds
+        bmu = f ds
+        f [] = error "DSOM has no models"
+        f xs = fst $ minimumBy (comparing snd) xs
 
 instance
   (GM.GridMap gm p, k ~ G.Index (GM.BaseGrid gm p), Pattern p,
@@ -130,7 +132,9 @@
   trainBatch s = foldl' justTrain s
   reportAndTrain s p = (bmu, ds, s')
     where ds = differences s p
-          bmu = fst $ minimumBy (comparing snd) ds
+          bmu = f ds
+          f [] = error "DSOM has no models"
+          f xs = fst $ minimumBy (comparing snd) xs
           s' = trainNeighbourhood s bmu p
 
 
diff --git a/src/Data/Datamining/Clustering/SOMInternal.hs b/src/Data/Datamining/Clustering/SOMInternal.hs
--- a/src/Data/Datamining/Clustering/SOMInternal.hs
+++ b/src/Data/Datamining/Clustering/SOMInternal.hs
@@ -183,7 +183,9 @@
      SOM f t gm k p -> p -> SOM f t gm k p
 justTrain s p = trainNeighbourhood s bmu p
   where ds = GM.toList . GM.map (p `difference`) $ gridMap s
-        bmu = fst $ minimumBy (comparing snd) ds
+        bmu = f ds
+        f [] = error "SOM has no models"
+        f xs = fst $ minimumBy (comparing snd) xs
 
 instance
   (GM.GridMap gm p, k ~ G.Index (GM.BaseGrid gm p), Pattern p,
