Fix envelope xml generation and Content-MD5