Fixed serializing of elements to XML.