Fixed an error with 'beautify_buffer' where it would add extra lines.  Fix is a bit hacky, but its functional