Make offset-reading code endian safe