diff --git a/ChangeLog b/ChangeLog
index ed09d5ef7580edc621d4201a9d671c42bd44e01d..e4b5f4435fd730e7aec2aa200aa17f1a8c39c181 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-23 Chris Allegretta <chrisa@asty.org>
+	* text.c: Reset openfile-> to OTHER after an undo or redo so we don't mistakenly
+	  mistakenly think this is an update when it's really an add.  Also
+          Fix an extra ; after an if statement which makes nano try to free a struct which
+          may be NULL
+
 GNU nano 2.1.3 - 2008.08.04
 2008-07-23 Chris Allegretta <chrisa@asty.org>
 	* configure.ac: Add ncursesw dir to include path if lib detected
diff --git a/src/text.c b/src/text.c
index 5226a321250afee3f4897f3f463c9090005fbfd9..eeca2c80c68feec5c279e55eed13433e04c68756 100644
--- a/src/text.c
+++ b/src/text.c
@@ -491,7 +491,7 @@ void do_undo(void)
     do_gotolinecolumn(u->lineno, u->begin, FALSE, FALSE, FALSE, TRUE);
     statusbar(_("Undid action (%s)"), undidmsg);
     openfile->current_undo = openfile->current_undo->next;
-
+    openfile->last_action = OTHER;
 }
 
 void do_redo(void)
@@ -638,6 +638,7 @@ void do_redo(void)
     statusbar(_("Redid action (%s)"), undidmsg);
 
     openfile->current_undo = u;
+    openfile->last_action = OTHER;
 
 }
 #endif /* !NANO_TINY */
@@ -814,7 +815,7 @@ void add_undo(undo_type current_action)
 	fs->undotop = fs->undotop->next;
 	if (u2->strdata != NULL)
 	    free(u2->strdata);
-	if (u2->cutbuffer);
+	if (u2->cutbuffer)
 	    free_filestruct(u2->cutbuffer);
 	free(u2);
     }