before applying new templete