fix bug: buf could has any bits