added a buffer_chomp function to drop the last character from the buffer