Index: /FCKeditor/trunk/editor/_source/classes/fckeditingarea.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckeditingarea.js	(revision 644)
+++ /FCKeditor/trunk/editor/_source/classes/fckeditingarea.js	(revision 645)
@@ -75,14 +75,16 @@
 
 			// Extract the BODY contents from the html.
-			var oMatch = html.match( FCKRegexLib.BodyContents ) ;
-
-			if ( oMatch )
-			{
+			var oMatchBefore = html.match( FCKRegexLib.BeforeBody ) ;
+			var oMatchAfter = html.match( FCKRegexLib.AfterBody ) ;
+
+			if ( oMatchBefore && oMatchAfter )
+			{
+				var sBody = html.substr( oMatchBefore[1].length,
+					       html.length - oMatchBefore[1].length - oMatchAfter[1].length ) ;	// This is the BODY tag contents.
+
 				html =
-					oMatch[1] +					// This is the HTML until the <body...> tag, inclusive.
+					oMatchBefore[1] +			// This is the HTML until the <body...> tag, inclusive.
 					'&nbsp;' +
-					oMatch[3] ;					// This is the HTML from the </body> tag, inclusive.
-
-				var sBody = oMatch[2].Trim() ;	// This is the BODY tag contents.
+					oMatchAfter[1] ;			// This is the HTML from the </body> tag, inclusive.
 
 				// If nothing in the body, place a BOGUS tag so the cursor will appear.
Index: /FCKeditor/trunk/editor/_source/internals/fckregexlib.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckregexlib.js	(revision 644)
+++ /FCKeditor/trunk/editor/_source/internals/fckregexlib.js	(revision 645)
@@ -33,5 +33,6 @@
 NamedCommands	: /^(?:Cut|Copy|Paste|Print|SelectAll|RemoveFormat|Unlink|Undo|Redo|Bold|Italic|Underline|StrikeThrough|Subscript|Superscript|JustifyLeft|JustifyCenter|JustifyRight|JustifyFull|Outdent|Indent|InsertOrderedList|InsertUnorderedList|InsertHorizontalRule)$/i ,
 
-BodyContents	: /([\s\S]*\<body[^\>]*\>)([\s\S]*)(\<\/body\>[\s\S]*)/i ,
+BeforeBody	: /(^[\s\S]*\<body[^\>]*\>)/i,
+AfterBody	: /(\<\/body\>[\s\S]*$)/i,
 
 // Temporary text used to solve some browser specific limitations.
Index: /FCKeditor/trunk/editor/_source/internals/fckundo.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckundo.js	(revision 644)
+++ /FCKeditor/trunk/editor/_source/internals/fckundo.js	(revision 645)
@@ -96,4 +96,6 @@
 FCKUndo._CheckIsBookmarksEqual = function( bookmark1, bookmark2 )
 {
+	if ( ! ( bookmark1 && bookmark2 ) )
+		return false ;
 	if ( FCKBrowserInfo.IsIE )
 	{
