fix template closure