fix problem when passing raw buffers