corrected the bytelength encoding