restored templates.c to original