Make sure templates are valid and fix parameter value parsing.
Remove perf from graph when an instance is deleted.