Added template_global, fixes #657