fix template scope