fix closure when multiple templates