--- admin-functions.php.orig	2006-02-16 15:41:48.307802607 -0500
+++ admin-functions.php	2006-02-16 15:40:17.702992454 -0500
@@ -102,7 +102,7 @@
 
 		// While we have the attachment ID, let's adopt any orphans.
 		$attachment = & get_post($id);
-		if ( ! is_object(get_post($attachment->post_parent)) ) {
+		if ( $attachment->ID && ! is_object(get_post($attachment->post_parent)) ) {
 			$attachment->post_parent = $post_ID;
 			wp_update_post($attachment);
 		}
@@ -112,7 +112,7 @@
 		++$i;
 	}
 
-	$post->post_content = str_replace($post_search, $post_replace, $post->post_content);
+	$post->post_content = addslashes_gpc(str_replace($post_search, $post_replace, $post->post_content));
 
 	return wp_update_post($post);
 }

