diff --git a/pandoc-crossref.cabal b/pandoc-crossref.cabal
--- a/pandoc-crossref.cabal
+++ b/pandoc-crossref.cabal
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                pandoc-crossref
-version:             0.1.2.2
+version:             0.1.2.3
 synopsis:            Pandoc filter for cross-references
 description:         pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them.
 license:             GPL-2
@@ -23,7 +23,7 @@
 source-repository this
   type: git
   location: https://github.com/lierdakil/pandoc-crossref
-  tag: v0.1.2.2
+  tag: v0.1.2.3
 
 executable pandoc-crossref
   main-is:             pandoc-crossref.hs
diff --git a/src/References/Blocks.hs b/src/References/Blocks.hs
--- a/src/References/Blocks.hs
+++ b/src/References/Blocks.hs
@@ -15,10 +15,11 @@
 import Util.Template
 
 replaceBlocks :: Options -> Block -> WS Block
-replaceBlocks opts x@(Header 1 _ _)
+replaceBlocks opts x@(Header 1 (_, cls, _) _)
   | sepChapters opts
   = do
-    modify (\r@References{curChap=cc} -> r{curChap=cc+1})
+    unless ("unnumbered" `elem` cls) $
+      modify (\r@References{curChap=cc} -> r{curChap=cc+1})
     return x
 replaceBlocks opts (Para (Image alt img:c))
   | Just label <- getRefLabel "fig" c
@@ -115,11 +116,11 @@
 replaceAttr o label title prop
   = do
     chap  <- gets curChap
-    index <- (1+) `fmap` gets (M.size . getProp prop)
+    index <- (1+) `fmap` gets (M.size . M.filter ((==chap) . fst . refIndex) . getProp prop)
     modify $ modifyProp prop $ M.insert label RefRec {
       refIndex=(chap,index)
     , refTitle=normalizeSpaces title
     }
-    if sepChapters o
+    if sepChapters o && chap>0
     then return $ Str (show chap) : chapDelim o ++ [Str (show index)]
     else return [Str (show index)]
