handle empty buffer cases