cleanup + fix saveXML