added tobuffer and torawbuffer