Fixes off-by-one in BufferWriter