Buffer in renderTemplate function