diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index c2e6d55..9c06d67 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -1771,7 +1769,8 @@ camel_folder_summary_add (CamelFolderSummary *s, CamelMessageInfo *info)
 	#warning "FIXME: SHould we ref it or redesign it later on"
 	/* The uid array should have its own memory. We will unload the infos when not reqd.*/
 	g_ptr_array_add (s->uids, (gpointer) camel_pstring_strdup((camel_message_info_uid(info))));
-	
+	g_hash_table_replace (_PRIVATE(s)->flag_cache, (char *)info->uid, GUINT_TO_POINTER(camel_message_info_flags(info)));
+
 	g_hash_table_insert (s->loaded_infos, (gpointer) camel_message_info_uid (info), info);
 	s->flags |= CAMEL_SUMMARY_DIRTY;
 
@@ -1802,9 +1801,13 @@ camel_folder_summary_insert (CamelFolderSummary *s, CamelMessageInfo *info, gboo
 		g_ptr_array_add (s->uids, (char *) camel_pstring_strdup(camel_message_info_uid(info)));
 	
 	g_hash_table_insert (s->loaded_infos, (char *) camel_message_info_uid (info), info);
+	if (load) {
+		g_hash_table_replace (_PRIVATE(s)->flag_cache, (char *)info->uid, GUINT_TO_POINTER(camel_message_info_flags(info)));
+	}
+
 	if (!load)
 		s->flags |= CAMEL_SUMMARY_DIRTY;
-
+	
 	CAMEL_SUMMARY_UNLOCK(s, summary_lock);	
 }
 
@@ -4665,7 +4668,11 @@ info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set)
 	return TRUE;
 }
 
-
+void
+camel_folder_summary_update_flag_cache (CamelFolderSummary *s, const char *uid, guint32 flag)
+{
+	g_hash_table_replace (_PRIVATE(s)->flag_cache, uid, flag);	
+}
 /**
  * camel_message_info_set_flags:
  * @mi: a #CamelMessageInfo
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 8d9a598..c553971 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -408,6 +408,7 @@ GPtrArray *camel_folder_summary_array(CamelFolderSummary *summary);
 GHashTable *camel_folder_summary_get_hashtable(CamelFolderSummary *s);
 void camel_folder_summary_free_hashtable (GHashTable *ht);
 GHashTable *camel_folder_summary_get_flag_cache (CamelFolderSummary *summary);
+void camel_folder_summary_update_flag_cache (CamelFolderSummary *s, const char *uid, guint32 flag);
 
 /* basically like strings, but certain keywords can be compressed and de-cased */
 int camel_folder_summary_encode_token(FILE *out, const char *str);
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index ae404f8..45cc60a 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -484,6 +484,7 @@ local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMess
 			
 			update_summary (s, (CamelMessageInfoBase *) mi, (CamelMessageInfoBase *) info);
 			mi->info.flags |= (camel_message_info_flags(info) & 0xffff);
+			camel_folder_summary_update_flag_cache (s, mi->info.uid, mi->info.flags);
 			mi->info.size = camel_message_info_size(info);
 		}
 
