Fixed issues with the xml write command.