diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py
index df5dd2e..90d9164 100644
--- a/offlineimap/folder/Maildir.py
+++ b/offlineimap/folder/Maildir.py
@@ -274,13 +274,14 @@ class MaildirFolder(BaseFolder):
         else:
             dir_prefix = 'new'
 
-        infostr = self.infosep
         infomatch = re.search('(' + self.infosep + '.*)$', newname)
         if infomatch:                   # If the info string is present..
-            infostr = infomatch.group(1)
+            oldinfo = infomatch.group(1) # of the form :2,...
+            oldflags = set(oldinfo[3:])
+            flags |= oldflags
             newname = newname.split(self.infosep)[0] # Strip off the info string.
-        infostr = re.sub('2,[A-Z]*', '', infostr)
-        infostr += '2,' + ''.join(sorted(flags))
+        infostr = self.infosep + '2,'
+        infostr += ''.join(sorted(flags))
         newname += infostr
         
         newfilename = os.path.join(dir_prefix, newname)
