fixing writeProtocolAsXml