bug fix: when bug was caused at empty buffer