Add deleteemptybuffer function