Some fixes to template