use buf variable