the bytes of the flag stream were being treated as signed integers instead of unsigned as specified in the spec.