diff --git a/src/kwsearch.c b/src/kwsearch.c
index 973eb60..4b14c04 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -112,10 +112,9 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
              one byte to ensure no infinite loop happens.  */
           mbstate_t s;
           memset (&s, 0, sizeof s);
-          size_t mb_len = mbrlen (mb_start, (buf + size) - (beg + offset), &s);
+          size_t mb_len = mbrlen (beg + offset, (buf + size) - (beg + offset), &s);
           if (mb_len == (size_t) -2)
             goto failure;
-          beg = mb_start;
           if (mb_len != (size_t) -1)
             beg += mb_len - 1;
           continue;
