Fixed applying template with dangerous function restrictions