bugfix: subtle bug about 'var' parameters in templates