referenced endbuf in final write