fixing html_buffer scope