diff --git a/ecrire/inc/import.php b/ecrire/inc/import.php
index 430c8e7df796953a46bf94d00041777783ed5a32..f93e95ef10cd1c304ca7730b4693faef83f3cd43 100644
--- a/ecrire/inc/import.php
+++ b/ecrire/inc/import.php
@@ -41,6 +41,7 @@ $GLOBALS['flag_ob_flush'] = function_exists('ob_flush');
 // Les balises commencant par <! sont ignorees
 // $abs_pos est globale pour pouvoir etre reinitialisee a la meta
 // status_restauration en cas d'interruption sur TimeOut.
+// Evite au maximum les recopies
 
 // http://doc.spip.org/@xml_fetch_tag
 function xml_fetch_tag($f, &$before, $_fread='fread', $skip='!') {
@@ -51,27 +52,29 @@ function xml_fetch_tag($f, &$before, $_fread='fread', $skip='!') {
 
 	while (($b=strpos($buf,'<'))===false) {
 		if (!($x = $_fread($f, 1024))) return '';
-		$buf .= $x;
+		if ($before)
+			$buf .= $x;
+		else $buf = $x;
 	}
 	if ($before) $before = str_replace($ent,$brut,substr($buf,0,$b));
 #	else { spip_log("position: $abs_pos" . substr($buf,0,12));flush();}
-	// pour ignorer un > de raccourci Spip avant un < de balise XML
 
-	$buf = substr($buf,++$b); 
+	// $b pour ignorer un > de raccourci Spip avant un < de balise XML
 
-	while (($e=strpos($buf,'>'))===false) {
+	while (($e=strpos($buf,'>', $b))===false) {
 		if (!($x = $_fread($f, 1024))) return '';
 		$buf .= $x;
 	}
-	if ($buf[0]!=$skip) {
-		$tag = substr($buf, 0, $e);
+
+	if ($buf[++$b]!=$skip) {
+		$tag = substr($buf, $b, $e-$b);
 		$buf = substr($buf,++$e);
-		$abs_pos += $e + $b;
+		$abs_pos += $e;
 		return $tag;
 	}
 
 	$buf = substr($buf,++$e);
-	$abs_pos += $e + $b;
+	$abs_pos += $e;
 	return xml_fetch_tag($f,$before,$_fread,$skip);
 }
 
diff --git a/ecrire/inc/import_1_3.php b/ecrire/inc/import_1_3.php
index b09860cf1a9065e770002c538a9e2129f9148c20..01bab9ead053d648445d8f69734cae78fdf7fc4a 100644
--- a/ecrire/inc/import_1_3.php
+++ b/ecrire/inc/import_1_3.php
@@ -127,21 +127,20 @@ function import_lire_champs($f, $fields, $gz, $phpmyadmin, $table)
 	$char = $GLOBALS['meta']['charset_insertion'];
 	if ($char == $GLOBALS['meta']['charset_restauration']) $char = '';
 
-	$b = false;
 	for (;;) {
+		$b = false;
 		if (!($col = xml_fetch_tag($f, $b, $gz))) return false;
 		if ($col[0] == '/') { 
 			if ($col != $table) {
-		    // autre tag fermant ici est une erreur de format
-			  spip_log("restauration de la table $table, tag fermant inattendu:");
-			  spip_log($col);
+				spip_log("restauration de la table $table, tag fermant inattendu:");
+				spip_log($col);
 		  }
 			break;
 		}
-		$value = true;
+		$value = $b = (($col != 'maj') AND (isset($fields[$col])));
 		if (!xml_fetch_tag($f, $value, $gz)) return false;
 
-		if ( ($col != 'maj') AND (isset($fields[$col])) ) {
+		if ($b) {
 			if ($phpmyadmin)
 				$value = str_replace($phpmyadmin[0],$phpmyadmin[1],$value);
 			if ($char)