restored template magic