handling buf