Appeal from a judgment of the County Court of Cortland County (Mullen, J.), rendered October 20, 1983, upon a verdict convicting defendant of the crimes of criminal possession of a controlled substance in the third degree and criminal sale of a controlled substance in the fifth degree.
*526On January 25, 1983, an undercover officer with the State Police, accompanied by a confidential informant, went to the residence of defendant for the purpose of consummating a drug sale which had been previously arranged by the informant. When the officer and the informant arrived at defendant’s residence, the officer, in the presence of the informant and defendant’s girlfriend, allegedly asked defendant the price at which she could purchase some “acid”. When the officer stated that defendant’s price of $5 per “hit” was too high, they agreed on a price of $4. The officer purchased five doses and gave defendant a $20 bill which he put into his pocket.
While defendant did not testify at trial, he contends that the testimony of his girlfriend and the informant established that the informant initiated the conversation with him concerning the possible purchase of drugs, that defendant never offered to sell them to him and that defendant refused on several occasions to sell drugs to the informant prior to the sale that resulted in his arrest. Such proof, defendant argues, established that he merely acted to accommodate the buyer and was, therefore, not a seller but an alter ego of the buyer. Therefore, the argument continues, while the trial court was correct in giving an agency charge to the jury over the People’s objection, the court erroneously charged that defendant could not be deemed an agent of the buyer if he derived financial gain from the sale. Defendant contends that the trial court also erred in charging that the jury must first find that a third-party seller existed before it could consider the question of agency.
While it is true that a charge that a defendant on trial for criminal possession and sale of a controlled substance to undercover police officers could only be considered an agent of the buyer if he acted “purely gratuitously”, and that if he received any financial gain from having participated in the transaction he would not be an agent of the buyer, is error (see, People v Lam Lek Chong, 45 NY2d 64, 75-76, cert denied 439 US 935), the error is harmless where, as here, there is no reasonable view of the evidence supportive of defendant’s position that he was acting as an agent. Therefore, defendant was not entitled to an agency charge (supra, p 76). In our view, this record utterly fails to indicate any agency relationship between defendant and the undercover officer. First, the proof establishes that the officer never met defendant, her so-called “agent”, until the time of the sale, (see, People v Argibay, 45 NY2d 45, cert denied sub nom. Hahn-Di Guiseppe v New York, 439 US 930). Second, the sale was contemporaneous with the request for the narcotic (see, People v Simpson, 85 AD2d 306). Third, the defendant, in *527insisting on a certain price for his high quality LSD, exhibited salesmanlike behavior (see, People v Windley, 78 AD2d 55). Fourth, the sale took place in defendant’s residence (see, People v Dory, 90 AD2d 853, affd 59 NY2d 121). Finally, defendant profited from the sale (see, People v Lam Lek Chong, supra).
Next, since we have concluded that, on this record, defendant was not entitled to an agency charge, we need not address defendant’s assertion that the trial court erred in its agency charge by stating to the jury that it must first find that a third-party seller existed before it could consider the question of agency.
We also reject defendant’s contention that an agency charge was mandated because the proof established that he merely delivered a quantity of LSD to accommodate his friend, the informant, while having no commercial interest in the transaction. This “subagent” theory fails because no reasonable view of the evidence suggests that defendant procured the drugs from a third party (see, People v Feldman, 50 NY2d 500 [defendant testified he purchased drugs for agreed-upon sum to accommodate his friend]; People v Roche, 45 NY2d 78, cert denied 439 US 958 [officer witnessed supplier hand drugs to defendant]; People v Simpson, supra). In this case, there is no indication that defendant was anything but the principal seller.
While we find defendant’s remaining allegations of error requiring a new trial to be without merit, we nevertheless are constrained to remit this matter for a hearing pursuant to the provisions of CPL 400.21.
Defendant argues that he was improperly sentenced as a second felony offender inasmuch as the trial court failed to conduct a hearing when defendant challenged the constitutionality of a prior felony conviction. The record reveals that, prior to the time the People rested, a conference was held among the prosecutor, defense counsel and the trial court concerning defendant’s prior conviction of criminal possession of a controlled substance in the fifth degree. At this conference, defendant admitted that he was the individual convicted of this crime. Later, in a posttrial motion and again at the sentencing hearing, defendant asserted that the prior conviction was unconstitutionally obtained. The trial court refused to grant a hearing, stating that defendant had failed to raise the constitutional issue at the trial conference.
A hearing on the constitutionality of a prior conviction is required where, as here, defendant admitted entering the plea but referred the sentencing court to the record of his prior plea, which he alleges proves that the evidence against him was *528illegally obtained. Pursuant to CPL 400.21 (7) (b), a hearing on the constitutionality of the prior conviction is mandatory (People v King, 88 AD2d 938, 939; People v Frett, 79 AD2d 991).
Judgment modified, on the law, by vacating the sentence; matter remitted to the County Court of Cortland County for further proceedings not inconsistent herewith; and, as so modified, affirmed. Mahoney, P. J., Kane, Casey, Weiss and Levine, JJ., concur.