modify buffer code