diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 0a0287e..8ee2b78 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -1225,6 +1225,10 @@ camel_folder_summary_migrate_infos(CamelFolderSummary *s)
 	if (fclose (in) != 0)
 		return -1;
 
+	record = (((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->summary_header_to_db (s, &ex));
+	if (!record) {
+		return -1;
+	}
 
 	camel_db_begin_transaction (cdb, &ex);
 
@@ -1234,15 +1238,11 @@ camel_folder_summary_migrate_infos(CamelFolderSummary *s)
 		camel_db_abort_transaction (cdb, &ex);
 		return -1;
 	}
-	camel_db_end_transaction (cdb, &ex);
-
-	record = (((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->summary_header_to_db (s, &ex));
-	if (!record) {
-		return -1;
-	}
 	
 	ret = camel_db_write_folder_info_record (cdb, record, &ex);
 
+	camel_db_end_transaction (cdb, &ex);
+
 	g_free (record->bdata);
 	g_free (record);
 
diff --git a/camel/camel-store.h b/camel/camel-store.h
index b15821b..750e88f 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -147,6 +147,7 @@ struct _CamelStore {
 #define CAMEL_STORE_FOLDER_INFO_RECURSIVE  (1 << 1)
 #define CAMEL_STORE_FOLDER_INFO_SUBSCRIBED (1 << 2)
 #define CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL (1 << 3)  /* don't include vTrash/vJunk folders */
+#define CAMEL_STORE_FOLDER_INFO_DISABLE_SUMMARY_LOAD (1 << 4)
 
 typedef struct {
 	CamelServiceClass parent_class;
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index c94acd5..30f88cb 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -289,7 +289,7 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
 	}
 
 	folder->summary = (CamelFolderSummary *)CLOCALF_CLASS(lf)->create_summary(lf, lf->summary_path, lf->folder_path, lf->index);
-	if (camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, NULL) == -1) {
+	if (!(flags & CAMEL_STORE_FOLDER_INFO_DISABLE_SUMMARY_LOAD) && camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, NULL) == -1) {
 		/* ? */
 		if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == 0) {
 			/* we sync here so that any hard work setting up the folder isn't lost */
