fix TemplateXML (exists action)

check argument '$name' before using