Fixing bug in decoding