fixes switching templates