modify buf