fix bug in handling 1D buffers