Fix handling of decoding