implement get_buf