fix WriteVarInt, it will now write the trully smallest form of the encoding