Fixed issue where existing XML config file would get overwritten if the XML was not well-formed.