Bytes parsing backported from Hardin