Fixed encoding issue before base64 encoding the message