Fixed the bug, which caused a message corruption if the previous message had no attahcment.