diff --git a/ChangeLog b/ChangeLog
index e9e249339789e473821cba97cda9feb54266b934..d0fdaa2f4c3d4f54c56e7ded52eda72d65d83a8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,7 +49,8 @@ CVS code -
 	  do_page_down(), do_para_end(), do_next_word(), do_prev_word(),
 	  do_up(), do_down(), do_scroll_down(), do_right(), do_mouse(),
 	  do_gotolinecolumn(), do_delete(), begpar(), find_paragraph(),
-	  and do_justify(). (DLR)
+	  do_justify(), do_wrap(), remove_magicline(), edit_scroll(),
+	  and edit_update(). (DLR)
 	- Add new -L/--nonewlines command line option, and new
 	  "nonewlines" rcfile option, to control whether nano adds
 	  magiclines to the ends of files.  Changes to read_file(),
diff --git a/src/text.c b/src/text.c
index a2623155313761162348139af304aab939356022..e23f5548af6097b794906233794dc5e8faf3eafb 100644
--- a/src/text.c
+++ b/src/text.c
@@ -432,7 +432,7 @@ bool do_wrap(filestruct *line)
     /* We prepend the wrapped text to the next line, if the
      * same_line_wrap flag is set, there is a next line, and prepending
      * would not make the line too long. */
-    if (same_line_wrap && line->next != NULL) {
+    if (same_line_wrap && line != openfile->filebot) {
 	const char *end = after_break + move_mbleft(after_break,
 		after_break_len);
 
diff --git a/src/utils.c b/src/utils.c
index 95cbdfa0ecd675098bee282cf56a28274aef45e8..719498492bf3174a7af0891e1d1157d7e85da5ec 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -494,7 +494,7 @@ void new_magicline(void)
 void remove_magicline(void)
 {
     if (openfile->filebot->data[0] == '\0' &&
-	openfile->filebot->prev != NULL) {
+	openfile->filebot != openfile->fileage) {
 	openfile->filebot = openfile->filebot->prev;
 	free_filestruct(openfile->filebot->next);
 	openfile->filebot->next = NULL;
diff --git a/src/winio.c b/src/winio.c
index 4b7c9f9f7f511f0eb27330c6b2b0c192c90fbf93..f7de0578b312b4cf9c639e5ceed5b544754e7594 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2634,11 +2634,11 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
      * there are fewer than nlines lines available. */
     for (i = nlines; i > 0; i--) {
 	if (direction == UP) {
-	    if (openfile->edittop->prev == NULL)
+	    if (openfile->edittop == openfile->fileage)
 		break;
 	    openfile->edittop = openfile->edittop->prev;
 	} else {
-	    if (openfile->edittop->next == NULL)
+	    if (openfile->edittop == openfile->filebot)
 		break;
 	    openfile->edittop = openfile->edittop->next;
 	}
@@ -2842,7 +2842,7 @@ void edit_update(update_type location)
 	    goal = editwinrows - 1;
     }
 
-    for (; goal > 0 && foo->prev != NULL; goal--)
+    for (; goal > 0 && foo != openfile->edittop; goal--)
 	foo = foo->prev;
 
     openfile->edittop = foo;