Fixed memory leak
Improved X-GM-MSGID support