prevent crash due to UnicodeDecodeError in the TemplatePanel