Cleans up invalid XML