Made applying template consistent with visible template