corrected controller of templates