
590 N.E.2d 104 (1992)
226 Ill. App.3d 944
168 Ill.Dec. 782
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Mark SOLES, Defendant-Appellant.
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Wayne GALINSKI, Defendant-Appellant.
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Raymond KLAWONN, Defendant-Appellant.
Nos. 2-90-0480, 2-90-0517, 2-90-0781 to 2-90-0784.
Appellate Court of Illinois, Second District.
April 1, 1992.
Rehearing Denied May 1, 1992.
G. Joseph Weller, Deputy Defender, Thomas A. Lilien, Asst. Defender, Office of State Appellate Defender, Elgin, for Mark Soles.
Michael J. Waller, Lake County State's Atty., Waukegan, William L. Browers, Deputy Director, State's Attys. Appellate Prosecutor, Elgin, for the People.
Justice DUNN delivered the opinion of the court:
In separate cases, defendants Mark Soles, Wayne Galinski, and Raymond Klawonn entered pleas of guilty to various offenses. Galinski was sentenced to a term of imprisonment; the other defendants were originally placed on probation but were sentenced to terms of imprisonment after admitting to violations of their probation. The defendants all filed motions to reconsider their sentences within 30 days of sentencing. Their appeals have been consolidated because they raise a common issue, whether the trial judge erred by refusing to consider these motions. We reverse and remand with directions to the trial court to allow each defendant to present his motion to reconsider and to rule on the merits of each motion.
*105 Defendant Galinski was charged with home invasion, aggravated criminal sexual assault, and residential burglary. He entered into a plea agreement with the State pursuant to which he pleaded guilty to home invasion, the other two counts were dropped, and the sentence would not exceed 20 years. After Galinski entered his plea the trial court sentenced him to a 20-year term of imprisonment.
Within 30 days of sentencing, Galinski filed with the trial court a motion to reconsider his sentence. When defendant's attorney attempted to present the motion, the trial judge stated that he would not hear it as there was nothing under the law which required him to reconsider a sentence. The judge also stated that he believed it was unfair to allow reconsideration of a sentence resulting from a negotiated plea unless the defendant also moves to withdraw the plea.
In People v. Stacey (1977), 68 Ill.2d 261, 12 Ill.Dec. 240, 369 N.E.2d 1254, the court interpreted Supreme Court Rule 604(d) (134 Ill.2d R. 604(d)) as requiring all criminal defendants who wish to appeal after entering pleas of guilty to first present motions to withdraw their guilty pleas to the trial court even if they only sought to challenge the sentence that was imposed. (Stacey, 68 Ill.2d at 265-67, 12 Ill.Dec. 240, 369 N.E.2d 1254.) More recently, however, our supreme court held that a motion to withdraw a guilty plea would not be a requisite for an appeal if a defendant had presented a motion to reconsider his or her sentence and was only challenging the sentence on appeal. (People v. Wilk (1988), 124 Ill.2d 93, 110, 124 Ill.Dec. 398, 529 N.E.2d 218.) The court noted in Wilk that the trial judge "had the opportunity to reconsider the appropriateness of the sentence imposed and to correct errors made, if any." (Wilk, 124 Ill.2d at 110, 124 Ill.Dec. 398, 529 N.E.2d 218.) The court also stated that since the two defendants in question "were not appealing their guilty pleas, it was not necessary for them to file a Rule 604(d) motion." 124 Ill.2d at 110, 124 Ill.Dec. 398, 529 N.E.2d 218.
Relying on Wilk, our supreme court determined that, in the above circumstances, a motion to reconsider the sentence imposed is a requisite to an appeal challenging the sentence. (People v. Wallace (1991), 143 Ill.2d 59, 61, 155 Ill.Dec. 821, 570 N.E.2d 334.) The court cited Wilk for the proposition that such a motion is necessary to enable the trial court to correct any errors. Wallace, 143 Ill.2d at 61, 155 Ill. Dec. 821, 570 N.E.2d 334.
The trial court's refusal to hear Galinski's motion to reconsider is completely inconsistent with Wilk and Wallace, which are premised upon the theory that trial courts should have the opportunity to correct any potential errors in sentencing before an appeal is taken. The trial court's refusal to hear Galinski's motion deprived it of any such opportunity. The requirement that a motion to reconsider be presented to the trial court before the sentence imposed after a guilty plea is appealed would be rather hollow if the trial court was not required to consider the merits of the motion.
The State argues that the rationale of Wilk and Wallace should not be applied in cases involving agreements to plead guilty in exchange for a limit on the sentence. The State contends that, by entering into the plea agreement, Galinski agreed to accept any sentence of 20 years or less. Therefore he should not be able to challenge his sentence without filing a motion to withdraw his guilty plea.
There is no language in Wilk or Wallace tending to support the State's position. As we have seen, the court stated in Wilk that because the defendants were not appealing their guilty pleas they were not required to file motions to withdraw the pleas. (Wilk, 124 Ill.2d at 110, 124 Ill.Dec. 398, 529 N.E.2d 218.) Likewise, Galinski is not appealing his guilty plea; therefore, under Wilk, he was not required to file a motion to withdraw his plea. We reject the State's contention to the contrary. We also disagree with the State's argument that, by entering into the plea agreement, Galinski agreed to accept any sentence of 20 years or less and conclude instead that he agreed to accept any such sentence if the trial court properly exercised its discretion in imposing it.
*106 Additionally, section 5-8-1(c) of the Unified Code of Corrections (Code) (Ill.Rev. Stat.1989, ch. 38, par. 1005-8-1(c)) states that "[a] motion to reduce a sentence may be made * * * within 30 days after the sentence is imposed." This provision further states that if such a motion is timely filed and the movant diligently seeks a ruling, "the court shall thereafter decide such motion within a reasonable time." (Ill.Rev.Stat.1989, ch. 38, par. 1005-8-1(c).) The word "shall" in a statute denotes a mandatory obligation unless the context in which the word appears indicates otherwise. (People v. Richardson (1984), 104 Ill.2d 8, 15, 83 Ill.Dec. 604, 470 N.E.2d 1024.) Because the language of section 5-8-1(c) does not indicate otherwise, we conclude that it requires trial courts to consider the merits of motions to reconsider and reduce sentences which are timely filed if the movants are diligent in seeking rulings. In so holding we agree with the statement of the court in People v. Chestnut (1973), 15 Ill.App.3d 188, 303 N.E.2d 440, that "[a] motion made in orderly fashion by counsel for defendant should be given consideration and the court should rule upon it." Chestnut, 15 Ill.App.3d at 190, 303 N.E.2d 440.
Defendants Klawonn and Soles both pleaded guilty to burglary and were originally sentenced to probation. After admitting to violations of the conditions of their probation, both were sentenced to the penitentiary. Within 30 days of sentencing both filed motions to reconsider their sentences. In Klawonn's case when his attorney attempted to present the motion, the trial judge stated that he would not give him a hearing on it.
Soles argues on appeal that when his attorney attempted to present his motion to reconsider, the trial judge refused to consider the motion. The State argues to the contrary. The record clearly supports Soles with respect to this issue. When Soles' attorney attempted to present the motion, the trial judge stated, "Motion to reconsider is not denied. A hearing on reconsideration is not allowed." It is therefore evident that the trial judge refused to make a ruling on the merits of the motion.
The State argues that Wilk and Wallace do not apply to the cases involving these two defendants because appeals from sentences imposed after probation revocations are governed by Supreme Court Rule 604(b) (134 Ill.2d R. 604(b)), rather than Supreme Court Rule 604(d) (134 Ill.2d R. 604(d)). Even if the State's argument is correct, section 5-8-1(c) of the Code still requires trial courts to consider the merits of and rule upon timely filed motions to reconsider and reduce sentences if the defendant's attorney is diligent in seeking a ruling. In all three cases that we are considering, the motions to reconsider sentence were filed timely and defense counsel was diligent in seeking a ruling on each motion. The trial court erred in each case by refusing to consider the merits of the motions.
For the above reasons the orders of the circuit court of Lake County refusing to consider the merits of defendants' motions are reversed. The causes are remanded with directions to the circuit court to allow each defendant to present his motion for reconsideration and to rule on the merits of each motion.
Reversed and remanded with directions.
UNVERZAGT and BOWMAN, JJ., concur.
