end decoding properly