fix order issue when creating xml.