diff --git a/src/proto.h b/src/proto.h
index 2afbbd5cafdc4ea1fe9da6687a01c2e378185db1..6eaafeb92cfe1c209bcd7acca1d65e60aa008292 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -590,7 +590,6 @@ int findnextstr(
 #endif
 	const filestruct *begin, size_t begin_x,
 	const char *needle, size_t *match_len);
-void reset_full_circle_flag(void);
 void do_search(void);
 #ifndef NANO_TINY
 void do_findprevious(void);
diff --git a/src/search.c b/src/search.c
index 664d2e17b2aa4cdedb45348d8c1b72e13f6cd371..dce899683378a80da5063b131babee5655c6a1de 100644
--- a/src/search.c
+++ b/src/search.c
@@ -336,7 +336,7 @@ int findnextstr(
 	}
 
 	/* If we're back at the beginning, then there is no needle. */
-	if (came_full_circle) {
+	if (came_full_circle && begin != NULL) {
 	    not_found_msg(needle);
 	    disable_nodelay();
 	    return 0;
@@ -399,7 +399,6 @@ int findnextstr(
 	return 0;
     }
 
-
     disable_nodelay();
 
     /* Set the current position to point at what we found. */
@@ -417,13 +416,6 @@ int findnextstr(
     return 1;
 }
 
-/* Clear the flag indicating that a search reached the last line of the
- * file.  We need to do this just before a new search. */
-void reset_full_circle_flag(void)
-{
-    came_full_circle = FALSE;
-}
-
 /* Ask what to search for and then go looking for it. */
 void do_search(void)
 {
@@ -505,7 +497,7 @@ void go_looking(void)
     size_t was_current_x = openfile->current_x;
     int didfind;
 
-    reset_full_circle_flag();
+    came_full_circle = FALSE;
 
     didfind = findnextstr(
 #ifndef DISABLE_SPELLER
@@ -653,7 +645,7 @@ ssize_t do_replace_loop(
     }
 #endif /* !NANO_TINY */
 
-    reset_full_circle_flag();
+    came_full_circle = FALSE;
 
     while (TRUE) {
 	int i = 0;
diff --git a/src/text.c b/src/text.c
index 870ae4d19107b674fbc47777a1b1b84895ff33cb..8c447ade35f6bb6f56c1e11d65c631da7b1761ad 100644
--- a/src/text.c
+++ b/src/text.c
@@ -2417,10 +2417,8 @@ bool do_int_spell_fix(const char *word)
     openfile->current = openfile->fileage;
     openfile->current_x = (size_t)-1;
 
-    reset_full_circle_flag();
-
     /* Find the first whole occurrence of word. */
-    result = findnextstr(TRUE, openfile->fileage, 0, word, NULL);
+    result = findnextstr(TRUE, NULL, 0, word, NULL);
 
     /* The word must exist; if not, something is wrong. */
     if (result == 0)