Use pooled buffers for template content, and fix compile error.