Fix encoding buffers with number type lengths