in reply to IMAP: mark message as unseen

Okay, I seem to have solved this. The problem was with the fork(). Apparently the $imap isn't carried to the child process as it should have. I now implement it all in one thread, and it seems to work perfectly.