forgot to initialize buf_end