diff --git a/ChangeLog b/ChangeLog
index a61e0e2bb667dabafe9e1f4ca7344e528110e407..60805692e204ea6b2878bb72dfaced8dfaf3f3e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -154,6 +154,9 @@ CVS code -
 	  wholewords, not after all other parameters. (DLR)
 	- Maintain current_y's value when moving up or down lines so
 	  that smooth scrolling works correctly. (DLR)
+- utils.c:
+  mark_order()
+	- Add check for MARK_ISSET's not being set. (DLR)
 - winio.c:
   unget_kbinput()
 	- New function used as a wrapper for ungetch(). (DLR)
diff --git a/src/files.c b/src/files.c
index 93ee44ae700061146a551a5e8862f47fa1fbf8df..376b34ac3b7a64cd1ada2ec710f63d1d68f3df94 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1719,7 +1719,7 @@ int write_marked(const char *name, int tmp, int append)
     int retval = -1;
     filestruct *fileagebak = fileage;
     filestruct *filebotbak = filebot;
-    int oldmod = ISSET(MODIFIED);
+    bool old_modified = ISSET(MODIFIED);
 	/* write_file() unsets the MODIFIED flag. */
     size_t topx;
 	/* The column of the beginning of the mark. */
@@ -1730,7 +1730,7 @@ int write_marked(const char *name, int tmp, int append)
 	/* The location of the character we nulled. */
 
     if (!ISSET(MARK_ISSET))
-	return -1;
+	return retval;
 
     /* Set fileage as the top of the mark, and filebot as the bottom. */
     if (current->lineno > mark_beginbuf->lineno ||
@@ -1763,7 +1763,7 @@ int write_marked(const char *name, int tmp, int append)
     *origcharloc = origchar;
     fileage = fileagebak;
     filebot = filebotbak;
-    if (oldmod)
+    if (old_modified)
 	set_modified();
 
     return retval;
diff --git a/src/utils.c b/src/utils.c
index d3d8e32c7f9a9a4f11477d0522ee6bb8615a0992..25c0d63c3048c5e24c625fb59152e4029c57cc9b 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -441,6 +441,10 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
 	**bot, size_t *bot_x)
 {
     assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
+
+    if (!ISSET(MARK_ISSET))
+	return;
+
     if ((current->lineno == mark_beginbuf->lineno && current_x > mark_beginx)
 	|| current->lineno > mark_beginbuf->lineno) {
 	*top = mark_beginbuf;