diff --git a/flatparse.cabal b/flatparse.cabal
--- a/flatparse.cabal
+++ b/flatparse.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           flatparse
-version:        0.5.2.0
+version:        0.5.2.1
 synopsis:       High-performance parsing from strict bytestrings
 description:    @Flatparse@ is a high-performance parsing library for strict bytestring input. See the README for more information:
                 <https://github.com/AndrasKovacs/flatparse>.
diff --git a/src/FlatParse/Basic/Switch.hs b/src/FlatParse/Basic/Switch.hs
--- a/src/FlatParse/Basic/Switch.hs
+++ b/src/FlatParse/Basic/Switch.hs
@@ -13,7 +13,7 @@
 
 import FlatParse.Common.Switch
 import FlatParse.Basic.Base ( ensure, skipBack, branch, failed )
-import FlatParse.Basic.Bytes ( bytes, bytesUnsafe )
+import FlatParse.Basic.Bytes ( bytesUnsafe )
 import FlatParse.Basic.Integers ( anyWord8Unsafe )
 
 {-|
@@ -130,7 +130,7 @@
 
         Path (r, n, alloc) ws t ->
           case ensure' alloc of
-            Nothing    -> [| branch $(bytes ws) $(go t) $(fallback r n)|]
+            Nothing    -> [| branch $(bytesUnsafe ws) $(go t) $(fallback r n)|]
             Just alloc -> [| branch ($alloc >> $(bytesUnsafe ws)) $(go t) $(fallback r n) |]
 
   letE
diff --git a/src/FlatParse/Common/Switch.hs b/src/FlatParse/Common/Switch.hs
--- a/src/FlatParse/Common/Switch.hs
+++ b/src/FlatParse/Common/Switch.hs
@@ -34,17 +34,15 @@
 listToTrie = foldl' (\t (!r, !s) -> insert r (charToBytes =<< s) t) nilTrie
 
 -- | Decorate a trie with the minimum lengths of non-empty paths. This
---   is used later to place `ensureBytes#`.
+--   is used later to place `ensure`.
 mindepths :: Trie Rule -> Trie (Rule, Int)
 mindepths (Branch rule ts) =
   if M.null ts then
     Branch (rule, 0) mempty
   else
-    let !ts' = M.map mindepths ts in
-    Branch (
-      rule,
-      minimum (M.map (\(Branch (rule,d) _) -> maybe (d + 1) (\_ -> 1) rule) ts'))
-      ts'
+    let !ts' = M.map mindepths ts
+        !min = minimum (M.map (\(Branch (rule,d) _) -> maybe (d + 1) (\_ -> 1) rule) ts') in
+    Branch (rule, min) ts'
 
 data Trie' a
   = Branch' !a !(Map Word (Trie' a))
@@ -73,7 +71,7 @@
     | Nothing <- rule' = Path (rule, n, d)  ws (go rule (n + length ws) t)
     | otherwise        = Path (rule', 0, d) ws (go rule' (length ws) t)
 
--- | Decorate with `ensureBytes#` invocations, represented as
+-- | Decorate with `ensure` invocations, represented as
 --   `Maybe Int`.
 ensureBytes :: Trie' (Rule, Int, Int) -> Trie' (Rule, Int, Maybe Int)
 ensureBytes = go 0 where
@@ -84,8 +82,8 @@
       | res < 1   -> Branch' (r, n, Just d ) (go (d   - 1) <$> ts)
       | otherwise -> Branch' (r, n, Nothing) (go (res - 1) <$> ts)
     Path (r, n, d) ws t -> case length ws of
-      l | res < l   -> Path (r, n, Just $! d - res) ws (go (d - l)   t)
-        | otherwise -> Path (r, n, Nothing        ) ws (go (res - l) t)
+      l | res < l   -> Path (r, n, Just d ) ws (go (d   - l) t)
+        | otherwise -> Path (r, n, Nothing) ws (go (res - l) t)
 
 compileTrie :: [(Int, String)] -> Trie' (Rule, Int, Maybe Int)
 compileTrie = ensureBytes . fallbacks . pathify . mindepths . listToTrie
diff --git a/src/FlatParse/Stateful/Switch.hs b/src/FlatParse/Stateful/Switch.hs
--- a/src/FlatParse/Stateful/Switch.hs
+++ b/src/FlatParse/Stateful/Switch.hs
@@ -13,7 +13,7 @@
 
 import FlatParse.Common.Switch
 import FlatParse.Stateful.Base ( ensure, skipBack, branch, failed )
-import FlatParse.Stateful.Bytes ( bytes, bytesUnsafe )
+import FlatParse.Stateful.Bytes ( bytesUnsafe )
 import FlatParse.Stateful.Integers ( anyWord8Unsafe )
 
 {-|
@@ -129,7 +129,7 @@
 
         Path (r, n, alloc) ws t ->
           case ensure' alloc of
-            Nothing    -> [| branch $(bytes ws) $(go t) $(fallback r n)|]
+            Nothing    -> [| branch $(bytesUnsafe ws) $(go t) $(fallback r n)|]
             Just alloc -> [| branch ($alloc >> $(bytesUnsafe ws)) $(go t) $(fallback r n) |]
 
   letE
diff --git a/test/Test.hs b/test/Test.hs
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -181,6 +181,16 @@
          )
           `shouldParse` "E"
 
+      it "doesn't reproduce bug #62" $
+        $( FB.switch
+             [| case _ of
+                 "0a" -> pure 0
+                 "abc" -> pure 1
+                 _ -> pure 3
+               |]
+         )
+          `shouldParsePartialWith` (B.take 2 "abc", 3)
+
     describe "switchWithPost" $ do
       it "applies post after match" $
         $( FB.switchWithPost
