Template fix to handle variable scope in Jinja2 for datasets with apps.