revert previous commit but avoid a 0 length buffer in scattered writes