fix bug with decoding