Bugfix. Lengt using bytes with the value 0 didn't work well (Ex: 256 0x01 0x00)
Refactor the marshalLength code