diff --git a/ChangeLog b/ChangeLog
index d0fdaa2f4c3d4f54c56e7ded52eda72d65d83a8a..9757720dd106deb33a791f6c26fa7589c6164834 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,8 +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(),
-	  do_justify(), do_wrap(), remove_magicline(), edit_scroll(),
-	  and edit_update(). (DLR)
+	  do_justify(), do_wrap(), remove_magicline(), and
+	  edit_scroll(). (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 e23f5548af6097b794906233794dc5e8faf3eafb..97e1ee28af02a19bcb3cda2c0b9a5ce2cc09f1d9 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1372,7 +1372,7 @@ void do_justify(bool full_justify)
 	    null_at(&openfile->current->data, break_pos);
 
 	    /* If the current line is the last line of the file, move
-	     * the last line of the file down. */
+	     * the last line of the file down to the next line. */
 	    if (openfile->filebot == openfile->current)
 		openfile->filebot = openfile->filebot->next;
 
diff --git a/src/winio.c b/src/winio.c
index f7de0578b312b4cf9c639e5ceed5b544754e7594..a6abbdbe233ab21f87bd92b16516024bde85be04 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2842,7 +2842,7 @@ void edit_update(update_type location)
 	    goal = editwinrows - 1;
     }
 
-    for (; goal > 0 && foo != openfile->edittop; goal--)
+    for (; goal > 0 && foo->prev != NULL; goal--)
 	foo = foo->prev;
 
     openfile->edittop = foo;