Improve handling of XML errors for fix permissions