cpp decoding but wrong results