Fixed creation of template