
122 Cal.Rptr.2d 844 (2002)
100 Cal.App.4th 1047
Butch K. LIANG, Petitioner,
v.
The SUPERIOR COURT of Los Angeles County, Respondent;
The People, Real Party in Interest.
No. B157292.
Court of Appeal, Second District, Division One.
August 1, 2002.
*845 Ogden & Motley and David A. Ogden, Los Angeles, for Petitioner.
No appearance for Respondent.
Steve Cooley, District Attorney, Patrick D. Moran and Brent Riggs, Deputy District Attorneys, for Real Party in Interest.
ORTEGA, Acting P.J.
Butch Liang and two others were charged with several felonies arising from their use of another person's identity to fraudulently acquire merchandise. Before the preliminary hearing, the court offered to impose probationary sentences on all the defendants if they all pled guilty to all counts. The court stated the offer was available only that day, and only if all three defendants accepted it. All three agreed to do so. All three entered no contest pleas.[1] The court continued the case for imposition of the indicated sentences.
Before the court imposed sentence, Liang's two codefendants, who are not parties to this writ proceeding, successfully sought to set aside their pleas because they were aliens who had not been permitted to consult consular officials. The prosecution opposed the codefendants' motion, but argued that if the court permitted the codefendants to withdraw their pleas, the court also should void Liang's plea. Liang, however, objected to his plea being set aside. (§ 1018.) Over Liang's objection, the court vacated his plea because the original offer was conditioned on all three defendants accepting it.
Liang then moved to dismiss the case against him, claiming further proceedings would violate double jeopardy. (§§ 1016, subds.(4), (5); 1023; U.S. Const., 5th Amend.; Cal. Const., art. I, § 15.)[2] The trial court denied the motion. Represented by the same attorney as in the trial court, Liang sought writ review. We stayed the trial court proceedings and issued an order to show cause. Later, we denied Liang's codefendants' motion to lift the stay as to them.
Liang contends he pled "open" to the court, admitting all charges. Liang argues he was not part of any plea bargain, and thus the court lacked power to vacate his plea over his objection. Liang concludes *846 double jeopardy mandates dismissal with prejudice as the only remedy for the error.
The People respond Liang pled as part of a conditional offer that all the defendants would plead no contest and all receive the indicated probationary sentences. The codefendants' withdrawal of their pleas violated the condition that the probationary sentence offer was conditioned on all the defendants accepting the bargain. As such, Liang was not entitled to enforce the bargain, and the court properly vacated his plea. If not, the People contend the proper remedy is to vacate the order withdrawing Liang's plea, putting him back in the position he was in before.
We agree with the People's first argument, deny the writ, and lift the stay.

FACTS
On July 19, 2001, all three defendants appeared with counsel before Judge Daniel Lopez. Liang's codefendants, represented by the same attorney with a conflict waiver filed, asked to discuss matters with the court. An unreported bench conference followed.
After the bench conference, the court stated: "As to each of youlet me address Mr. Liang, the offer extended to you, Mr. Liang, is five years formal probation, one year in county jail. I'll extend the option of work furlough or a local trustee program, or you can apply for work release through the sheriffs department, with no guarantee that you will be released from the alternative program to county jail. I'll extend the option to you. I'll let your attorney assist you in figuring out the best option for you in that regard. [K] Do you understand this offer, Mr. Liang?
"Defendant Liang: Yes, your Honor.
"The Court: As to your case, Mr. Liang, the charge involves [a] false financial statement on May 17, 2001, count 1. Count 2 is false personation; count 3 is commercial burglary involving Sears; count 4 involves grand theft of personal property from Sears; count 5 involves identity theft; count 6 involves possession of a forged driver's license. Your maximum in this case appears to be ... five years eight months. [¶] ... [F]ive years eight months is your maximum. [¶] Do you understand that, Mr. Liang?
"Defendant Liang: Yes, your Honor.
"The Court: Do you understand the offer extended today to you?
"Defendant Liang: Yes.
"The Court: Do you wish to accept the offer today or reject it?
"Defendant Liang: I accept.
"The Court: As to the co-defendants this is a package offer, so I'll extend the following offer to each of you, defendant Lu and defendant Yang. [¶] As to defendant Yang, you are charged in counts 2, 3, and 4 with false personation, commercial burglary, and grand theft of personal property. Your maximum exposure time appears to be four years eight months, [¶] Do you understand that, Mr. Yang?
"Defendant Yang: Yes.
"The Court: As to Defendant Lu, you are charged in counts 1, 2, 3 and 4.... [Y]our maximum appears to be five years in state prison. [¶] Do you understand that, Mr. Lu?
"Defendant Lu: Yes.[3]
*847 "The Court: As to you two individuals the court's offer is five years formal probation, 180 days in county jail, with the option again of work furlough, work release program or local trustee program. [¶] Do you understand this offer to you, [Mr.] Lu?
"Defendant Lu: Yes.
"The Court: Do you wish to accept this or reject it at this time?
"Defendant Lu: I need more time to consider it.
"The Court: Today is the date. The offer expires today. This is a package deal. Let me further advise each of the defendants, upon completion of three years['] formal probation, I will entertain a motion to reduce the charge[s] to misdemeanors, terminate and dismiss the case upon successful completion of probation which means no further violations of probation. [¶] As to defendant Lu, the offer on the table today, this offer expires today if one of you rejects it, the offers are off the table as to everyone." (Emphasis added.) Both codefendants then told the court they accepted the offer.
The court then advised each defendant of the consequences of any plea and violations of probationary conditions. The court stated that pleas would result in deportation if the defendants were not U.S. citizens. The court advised each defendant of his rights, including the right to a preliminary hearing, which would be given up if defendants accepted the offer. All defendants stated they understood the consequences of any pleas and waived their rights.
During the court's advisements, the following colloquy occurred: "The Court: Have any other promises been made to you other than what I have told you today here in open court, Mr. Liang?
"Mr. Liang: No." (Emphasis added.)
At the court's request, the prosecutor then asked the defendants for their pleas. All three defendants, including Liang, pled no contest to all the charges alleged against them. All three defendants answered "[y]es" to the prosecutor's question: "Are you entering this plea today because you feel it is in your best interest to do so ... ?" Their attorneys joined, acknowledging the pleas were voluntary and had a factual basis. The court then continued the case for sentencing for all three defendants.
On December 3, 2001, the three defendants again appeared before Judge Lopez for sentencing. The same attorney represented Liang, but a new attorney, who also filed a conflict waiver, represented the two codefendants.
Before any sentencing hearing, however, the court considered motions by Liang's two codefendants, apparently non-U.S. citizens, to withdraw their pleas under section 1018 because they had not been allowed to consult with their nation's consulate before entering their pleas. The prosecutor opposed the motion, arguing the codefendants had not alleged any prejudice from the failure. As part of her opposition, the prosecutor stated that if the court granted the motions, it should also withdraw Liang's plea.
The prosecutor stated: "[T]he court should also reject the plea by ... Liang because that was certainly a part of the understanding when all three defendants entered their pleas. It was a package deal and the People do not now want to be placed in the position of having to go to *848 trial on the two defendants who were not necessarily the heav[ies] in this case because of ... some strategic or tactical maneuver on the [co]defendants' part. [¶] In light of that the People do oppose the withdrawal of the plea[s]. However, if the court does intend to withdraw [them], the People would ask that ... Liang's plea also be rejected."
After further argument, Judge Lopez granted the codefendants' motion to withdraw their pleas. The court then addressed Liang: "Let me address [Liang]. I do agree with the People's position that this is a package deal. I want to address that issue." (Emphasis added.) Judge Lopez again reviewed the July 19, 2001, transcript. Judge Lopez then began argument on the issue of Liang's plea by repeating that "this particular plea agreement ... was a package offer extended to Mr. Liang." (Emphasis added.)
Liang's counsel began by stating Liang had no knowledge of the codefendants' motion to withdraw their pleas and did not communicate with them about the motion. Counsel then stated a "package plea only exists prior to the entry of that plea. The People can justifiably refuse to let any codefendant plead other than straight up. This was not a package deal by the People. ..."
After the prosecutor said her case file noted a package offer of five years' probation and 270 days in custody for all defendants, Liang's counsel said: "[T]he court took individual pleas to every count for Mr. Liang on the court's offer which was five years[`] formal probation, one year county jail for Mr. Liang, with an option of local jail work, furlough, work release or a trustee program and $200 fine. So it was not a package deal. It was not a People versus West plea bargain involving the People at all. It was an open plea to this court." (Emphasis added.)
Judge Lopez then reviewed his notes regarding the July 19, 2001, proceedings. Judge Lopez noted his practice was to extend package deals in codefendant cases. He also stated his notes reflected the prosecution's position and that he increased his indicated sentence to Liang to one year, and reduced his indicated sentence to the codefendants to six months because Liang was charged with more counts and had a greater maximum sentence. Liang's counsel agreed with Judge Lopez' description of the pre-plea discussion.
Judge Lopez stated: "When the court makes reference to a package deal, I'm not saying two out of three defendants. My intention at the time was all three defendants entering a plea to resolve the matter. I want to make that clear that it just did not involve the two co-defendants. It involved all three defendants." Liang's counsel replied: "And all three defendants pled open totally to the court."
After again arguing that Liang "pled open" to the court and should not have his plea withdrawn, Liang's counsel concluded: "Based on the court's indicated sentence I will stipulate to a note in the file ... that ... Liang ... still wishes the benefit of his plea agreement with the court, so that that may be considered in any future plea negotiations." (Emphasis added.)
Judge Lopez then ruled: "[B]y virtue of the co-defendants[`] actions and the court's ruling today, the court cannot carry out the terms of a package deal because two of the three defendants no longer are part of the package, [¶] I do agree ... if the motions [to withdraw the pleas] were indeed denied and reversed on appeal, then Mr. Liang could proceed forward. My analysis of this case is it is a probation case worth a year in county jail. [¶] My greater concern is that ... in the interest of justice, I'm not only examining fairness *849 to [Liang] but fairness to the prosecution in terms of this particular package deal and plea bargain agreement that was offered by the court, and for those reasons the court is rejecting Mr. Liang's plea over [Liang]'s objection." When Liang's counsel repeated his objection to the ruling, Judge Lopez concluded: "A deal is a deal and if two of the three defendants don't want the deal, then the whole deal is off." Judge Lopez then continued the case against all the defendants, none of whom was in custody.
On February 20, 2002, Liang, who entered once in jeopardy and not guilty pleas after Judge Lopez withdrew Liang's no contest pleas, moved to dismiss the charges with prejudice based on double jeopardy. On March 11, 2002, Judge Jack Hunt denied the motion.
During argument, in response to Liang's counsel's statement that Liang "pled open" to Judge Lopez, Judge Hunt interjected: "Wait a minute. Any time the court gives an indicated sentence it is not an open plea. An open plea is when the defendant stands up to every single count with no offer from the court. That is an open plea, sir. [¶] Go ahead." In response, Liang's counsel stated: "The status is that that exactly didn't happen." Liang's counsel continued that Liang should not be forced to withdraw his plea based on his codefendants' successful motions to withdraw their pleas.
Judge Hunt concluded: "[T]his was a conditional plea on condition that all three plead. Once their pleas were set aside they go back to square one."

DISCUSSION
Our resolution of this case turns on whether Liang "pled open" or unconditionally, as he contended below and before us, or pled guilty to all counts as part of a conditional offer or bargain in which he would receive the indicated probationary sentence only if all three defendants pled guilty. As the prosecution contended below and before us, we conclude Liang pled as part of a conditional offer. When Liang's codefendants withdrew their pleas, one of the bargain's conditions was voided. As such, Judge Lopez properly vacated Liang's no contest pleas even over Liang's objection. Under these circumstances, Liang was not subjected to double jeopardy.
First, we review the July 19, 2001, proceedings to determine what happened. The three defendants were charged together. The preliminary hearing had not been held. The parties, including the prosecutor, both defense attorneys, and Judge Lopez then had an unreported bench conference. As Judge Lopez confirmed during the December 3, 2001, hearing at which the court vacated Liang's pleas, the prosecution's preliminary case evaluation recommended probationary sentences with nine months in custody for each defendant. Judge Lopez offered the defendants the recommended probationary sentences, but increased Liang's offered custody time to one year because he was charged with more counts and had a greater potential maximum sentence, and correspondingly reduced the codefendants' offered custody time to six months. Substantial evidence supports a conclusion that settlement negotiations occurred during the bench conference.
Immediately thereafter, Judge Lopez made the offers to the defendants. The offers' terms were that in exchange for guilty pleas by each defendant to all counts, each defendant would receive the offered probationary sentence with the specified amount of custody time, substantially less than defendants' potential maximum punishment. The offers' other condition *850 was that they constituted a package deal, available only if all three defendants accepted the bargain.
Liang notes the offer did not involve dismissal of any charges, which could only be done by the prosecutor, not the court. Thus, Liang technically argues correctly that there was no charge bargain with the prosecution. However, Liang is incorrect in arguing that his plea was open or unconditional. In fact, Liang's plea unequivocally was made to accept an indicated sentence far more lenient than his potential maximum, and thus was a sentence bargain. Moreover, the second condition was that any one defendant could receive the lenient indicated sentence only if all the defendants agreed to plead guilty.
Thus, Liang unequivocally entered his pleas in exchange for a lenient indicated sentence. He did not plead unconditionally, admitting all charges and exposing himself to the maximum possible sentence if the court later chose to impose it. An "`open plea' [is one] under which [the defendant] was not made any promises." (People v. Williams (1998) 17 Cal.4th 148, 156, 69 Cal.Rptr.2d 917, 948 P.2d 429.) Liang's attorney admitted as much during the December 3, 2001, hearing, when he insisted that Liang wanted the lenient probationary sentence he bargained for at the July 19, 2001, hearing. Moreover, during the July 19, 2001, proceedings, Liang repeatedly admitted he sought and received an "offer" and pled guilty because of the "promise" that he would receive the offered sentence, after having been told he could only obtain the "offered" sentence if his codefendants also pled guilty.
Neither below nor now does Liang claim that package offers, where one defendant's ability to avail himself of the offered benefits is contingent on the other defendants doing so as well, are invalid, either generally or under the terms specifically offered on July 19, 2001. Indeed, so long as the terms are not coercive, such offers are valid. (In re Ibarra (1983) 34 Cal.3d 277, 286-290, 193 Cal.Rptr. 538, 666 P.2d 980, disapproved on other grounds in People v. Howard (1992) 1 Cal.4th 1132, 1175-1178, 5 Cal.Rptr.2d 268, 824 P.2d 1315.) Here, the prosecutor stated she wanted a package deal to prevent one defendant, who had pled guilty and received a lenient sentence, from deflecting responsibility from culpable co-perpetrators. Apparently, Judge Lopez accepted that position by making each lenient indicated sentence part of a package deal in which no defendant could receive it unless all the defendants pled guilty. We reject Liang's suggestion that such a motive is improper. "We recognize that the `package-deal' may be a valuable tool to the prosecutor, who has a need for all defendants, or none, to plead guilty. The prosecutor may be properly interested in avoiding the time, delay and expense of trial of all the defendants. He is also placed in a difficult position should one defendant plead and another go to trial, because the defendant who pleads may become an adverse witness on behalf of his codefendant, free of jeopardy. Thus, the prosecutor's motivation for proposing a `package-deal' bargain may be strictly legitimate and free of extrinsic forces." (Id. at p. 289, fn. 5.)
None of the defendants had been sentenced when Liang's codefendants withdrew their pleas. Those withdrawn pleas deprived the prosecution of the benefits of the package deal, and unequivocally violated the terms of Judge Lopez' original indicated sentences, each of which was conditioned on all the defendants accepting the bargain. Contrary to Liang's argument, by insisting on his right to the indicated sentence although his codefendants have withdrawn their guilty pleas, Liang is trying *851 to receive the benefits of his bargain when an express reciprocal condition was voided. Moreover, Liang has not been deprived of any right to receive the indicated sentence. He only had that right if all three defendants agreed to plead guilty. Two of the defendants eventually chose not to so plead, thus voiding Liang's ability to secure the indicated sentence. Liang is in the same position he would have been in had his codefendants refused to plead guilty on July 19.
Liang relies on section 1018 to support his claim that a defendant's guilty plea can only be withdrawn on the defendant's motion. Section 1018 requires that defendants enter noncapital felony pleas in open court when represented by counsel, unless they waive counsel. The section continues: "On application of the defendant at any time before judgment or within six months after an order granting probation is made if entry of judgment is suspended, the court may ... for a good cause shown, permit the plea of guilty to be withdrawn and a plea of not guilty substituted.... This section shall be liberally construed to effect these objects and to promote justice." (Emphasis added.)
First, section 1018 provides a mechanism by which a defendant who has entered a plea may move to withdraw it before judgment is entered. Section 1018 does not contain language precluding the court from vacating such a plea on its own or the prosecution's motion. Moreover, section 1018 says it is to be construed to promote justice.
Section 1018 simply does not apply. Liang did not seek to withdraw his plea, and the trial court did not invoke section 1018 as authority to vacate Liang's plea. The trial court vacated Liang's plea over his objection because a necessary condition for a bargained-for disposition did not occur.
The issue is whether the trial court can involuntarily vacate a defendant's guilty plea entered to receive an indicated sentence before sentencing because an express condition for receipt of the sentence is not fulfilled. None of the cases upon which Liang relies support his claim that the trial court may not do so. In People v. Gonzalez (1993) 13 Cal.App.4th 707, 715, 16 Cal.Rptr.2d 635, the defendant pled guilty before trial to second-degree murder for a particular sentence, which was imposed. On appeal, he claimed the trial court should have construed his statement to the probation officer that the killing was accidental as a motion to withdraw his plea. The appellate court affirmed because under section 1018 only the defendant may move to withdraw his plea. The case did not involve the failure of a condition for a bargained-for settlement. Moreover, Gonzalez did not preclude a court from vacating a plea over a defendant's objection where a bargained-for condition did not occur.
In People v. McGee (1991) 232 Cal. App.3d 620, 623-624, 283 Cal.Rptr. 528, the defendant pled guilty in exchange for a probationary sentence. Before sentencing, however, the trial court granted the defendant's motion to withdraw his plea, finding the plea involuntary. Later, the trial court granted the prosecution's motion, based on the defendant's alleged failure to show prejudice, to reinstate the defendant's guilty plea. The trial court imposed the agreed sentence, and the defendant appealed. The appellate court reversed, holding that once the court granted the defendant's motion to withdraw his plea, it could not reinstate the guilty plea on its own or the prosecution's motion. McGee does not apply to a court's power to vacate a guilty plea because a bargained-for condition to that plea failed.
*852 In Gonzalez v. Municipal Court (1973) 32 Cal.App.3d 706, 108 Cal.Rptr. 612, the defendant pled guilty to drunk driving and admitted prior drunk driving convictions. Before sentencing, the defendant successfully moved to strike the prior convictions on constitutional grounds. The trial court then, based on an argument that the motion to strike the priors was an implied motion to withdraw the guilty plea to the current charge, set aside the guilty plea, and later denied the defendant's motion to dismiss based on double jeopardy. The defendant sought writ review. The appellate court reversed, holding a motion to strike priors, permitted on statutory and constitutional grounds, cannot be construed as a motion to withdraw a guilty plea to the current charge. Because that was the only ground asserted in support of the trial court's action, double jeopardy required the current charges be dismissed with prejudice. That case does not address vacation of a guilty plea because of a failure of a bargained-for condition. Moreover, in that case the trial court erroneously construed the motion to strike the priors as a motion to withdraw the plea, and erroneously withdrew the plea. Here, Judge Lopez did not rely on such a theory. Double jeopardy only bars retrial where the plea is erroneously vacated, not where the trial court acts correctly.
Finally, in People v. Allan (1996) 49 Cal.App.4th 1507, 57 Cal.Rptr.2d 269, the defendant was charged with one felony and one misdemeanor, and several prior conviction enhancements. Before trial and over the prosecution's objection, the trial court struck the prior conviction allegations. The trial court then gave an indicated sentence for a guilty plea to the felony. Over the prosecution's objection, the defendant pled guilty to the felony. The trial court then dismissed the misdemeanor on its own motion over the prosecution's objection, and imposed the indicated sentence on the felony. The People appealed, and the appellate court reversed, finding the procedure constituted an illegal plea bargain. The trial court could not dismiss the misdemeanor; only the prosecutor could do so. The appellate court rejected the defendant's argument that the indicated sentence made the procedure acceptable, because the defendant did not plead to all the charges and enhancements, but only to the felony. We reject Liang's claim that Allan compels reversal on our facts.
As discussed above, Judge Lopez conditioned his indicated sentence on the codefendants also pleading guilty. Liang only pled guilty because he was promised a lenient sentence, and he could only get that sentence if both his codefendants also pled guilty. Liang ignores the existence of the package deal and its express condition, which his codefendants refused to accept.
Bargained-for guilty pleas may be vacated over the defendant's objection, even after imposition of the bargained-for sentence, if a condition of the bargain later is not fulfilled. In People v. Collins (1996) 45 Cal.App.4th 849, 862-865, 53 Cal. Rptr.2d 367, a juvenile defendant charged with murder and the prosecution agreed the defendant could plead guilty to being an accessory (§ 32) and be sentenced to the Youth Authority, in exchange for dismissal of the murder charges and his truthful testimony against an adult codefendant. The defendant pled to the reduced charge, received the indicated sentence, and the prosecution dismissed the murder charges. The defendant testified at the codefendant's trial, but did not do so truthfully. Over the defendant's objection, the trial court granted the prosecution's motion, vacated the plea, and reinstated the murder charge. The defendant later pled guilty to several reduced charges, but *853 appealed, claiming he should not have had his original plea and sentence vacated. The appellate court affirmed, rejecting the claim, finding the prosecution properly sought vacation of the plea because the conditions of the bargain no longer existed.
Liang repeats his claim that Collins does not apply because he 1) pled open and there was no bargain, and 2) was not responsible for his codefendants withdrawing their pleas. We have already rejected his claim that he pled open. Moreover, neither the court nor the prosecution was responsible for the codefendants' actions. Had the codefendants refused to accept the package offer on July 19, Liang could not have received the indicated sentence.

DISPOSITION
We deny the writ and dissolve our previously imposed stay.
We concur: MIRIAM A. VOGEL and MALLANO, JJ.
NOTES
[1]  A no contest plea to a felony has the same effect in all respects as a guilty plea. (Pen. Code, § 1016, subd. (3); all further section references are to the Penal Code.) Hereafter we interchangeably refer to defendants' pleas as no contest or guilty pleas.
[2]  "When the defendant is convicted or acquitted or has been once placed in jeopardy upon an accusatory pleading, the conviction, acquittal, or jeopardy is a bar to another prosecution for the offense charged in such accusatory pleading, or for an attempt to commit the same, or for an offense necessarily included therein, of which he might have been convicted under that accusatory pleading." (§ 1023.)

"No person shall ... be subject for the same offense to be twice put in jeopardy of life or limb...." (U.S. Const., 5th Amend.)
"... Persons may not twice be put in jeopardy for the same offense...." (Cal. Const., art. I, § 15.)
[3]  According to the Information filed January 30, 2002, Liang was charged with six felonies, all committed on the same date: making a false financial statement (§ 532a, subd. (1)); false impersonation (§ 529); commercial (second degree) burglary (§§ 459, 460); grand theft of over $400 (§ 487, subd. (a)); identity theft (§ 530.5, subd.(a)); and possessing a forged driver's license (§ 470b). Liang's codefendants were charged with the first four of those crimes.
