fix empty buffer