generate template only on demand