Added checking for template xml existing.