handle 0 buf bug. add debug info