Fix decoding of invalid byte and text strings