fixed bug in templates