Appeal from a judgment of the Jefferson County Court (Kim H. Martusewicz, J.), rendered April 7, 2003. The judgment convicted defendant, upon his plea of guilty, of criminal sale of a controlled substance in the fourth degree.
It is hereby ordered that the judgment so appealed from be and the same hereby is unanimously modified on the law by vacating the sentence and as modified the judgment is affirmed, and the matter is remitted to Jefferson County Court for further proceedings in accordance with the following Memorandum: On appeal from a judgment convicting him upon his plea of guilty of criminal sale of a controlled substance in the fourth degree (Penal Law § 220.34 [1]), defendant contends that the indictment must be dismissed because he was required to appear before the grand jury in shackles and manacles despite the absence of a reasonable basis set forth in the record for that requirement (see People v Rouse, 79 NY2d 934, 935 [1992]; People v Pennick, 2 AD3d 1427 [2003], lv denied 1 NY3d 632 [2004]). We note at the outset that, contrary to the People’s contention, defendant’s challenge is to the integrity of the grand jury proceeding (see e.g. Pennick, 2 AD3d at 1427-1428, lv denied *11561 NY3d 632 [2004]), and such a challenge survives defendant’s guilty plea (see generally People v Hansen, 95 NY2d 227, 230-231 [2000]; People v Pelchat, 62 NY2d 97, 108 [1984]). On the merits, however, although we agree with defendant that the requisite reasonable basis for the restraint was not set forth in the record, we nevertheless conclude that the prosecutor’s cautionary instructions to the grand jury dispelled any possible prejudice to defendant (see Pennick, 2 AD3d at 1427-1428; People v Neubauer, 296 AD2d 557 [2002], lv denied 98 NY2d 731 [2002]; People v Felder [appeal No. 2], 201 AD2d 884, 885 [1994], lv denied 83 NY2d 871 [1994]).
We further agree with defendant that County Court erred in imposing restitution where, as here, restitution was not included in the terms of the plea agreement. Contrary to the People’s contention, defendant preserved his contention for our review by objecting at the time of sentencing when the court ordered him to pay restitution (see generally People v Lovett, 8 AD3d 1007 [2004]; People v Holmes, 306 AD2d 889 [2003], lv denied 100 NY2d 621 [2003]), and he was not in addition required to request a restitution hearing to determine the proper amount of restitution. Because restitution was not included in the terms of the plea agreement, the court erred in ordering him to pay restitution without first affording him the opportunity to withdraw his guilty plea (see People v Delair, 6 AD3d 1152 [2004]; People v Hendrix, 2 AD3d 1479 [2003]; People v Austin, 275 AD2d 913 [2000]). We therefore modify the judgment by vacating the sentence, and we remit the matter to County Court to impose the sentence promised or to afford defendant the opportunity to withdraw his plea. Present—Green, J.P., Gorski, Martoche, Lawton and Hayes, JJ.