Migrating Mails from Dovecot to Cyrus ... what a pain!

Today I had to move an Inbox of some Gig mail to transfer from a dovecot to a cyrus imap server. I thought using imapsync would just do the trick, but no it doesn't. Many of the messages wasn't transferable cause "Message contains invalid header".
I tried to upgrade imapsync, dovecot and cyrus to the latest version, but nothing fixed the problem. Digging around in the ned did lead me after hours to Renes How to fix emails for Cyrus LMTP and IMAP. I did throw his script on the Inbox of the dovecot server, but this did lead me into getting "FETCH for mailbox got too little data" in the dovecot server log and breaking down the connection of the imap client to the server. This could be fixed while removing corresponding dovecot.index.cache and restarting the server.