fix buf in Buffer constructor where variable was getting overwritten