fix bug in XML parser (writing error)