Avoid issues when editing Ktemplate when XML is malformed
Merge pull request #1977 from xillibit/k30_bugs16

 Avoid issues when editing Ktemplate when XML is malformed