Fixed bug: buffer_printf appends to the buffer, so buffer_tostring
is not needed (and caused a crash).