corrected somme mistake in tamplate and createMain with template.