fix bug with realloc on empty buffer
25% faster writeVarint

+val is the same as Number(val) but slower