Hacky fix to a problem of decoding different encodings