
663 N.E.2d 22 (1996)
278 Ill. App.3d 498
215 Ill.Dec. 272
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Michael McCLEARY, Defendant-Appellant.
No. 1-94-2706.
Appellate Court of Illinois, First District, First Division.
February 26, 1996.
Rehearing Denied April 2, 1996.
*23 Rita Fry, Public Defender of Cook County (Todd Avery Shanker, Asst. Public Defendant, of counsel), for defendant-appellant.
Jack O'Malley, State's Attorney, County of Cook (Renee Goldfarb and Latisha Foster, Asst. State's Attorneys, of counsel), for plaintiff-appellee.
Justice WOLFSON delivered the opinion of the court:
Michael McCleary, found guilty of two voluntary manslaughter charges, contends he must be resentenced for two reasons: First, the trial court failed to advise him of his right to elect to be sentenced under the law in effect at the time the crimes were committed; second, the trial court believed consecutive sentences were required by law, when they were not.
Despite the defendant's failure to preserve these issues for appeal, we vacate the sentences imposed and remand this cause for resentencing.

PROCEEDINGS IN THE TRIAL COURT
McCleary originally was charged with two counts of murder in relation to the May 14, 1986, bludgeoning death of Ivory Barrett and Tony King. He was tried by a jury and found guilty but mentally ill on both counts. On appeal, his convictions were reversed and the case remanded for a new trial. See People v. McCleary (1990), 208 Ill.App.3d 466, 153 Ill.Dec. 476, 567 N.E.2d 434.
On remand, McCleary was found guilty but mentally ill on two counts of voluntary manslaughter. On June 3, 1994, he was sentenced to two consecutive terms of 14 years imprisonment.
Until 1986, consecutive sentencing for these offenses was discretionary. Ill.Rev. Stat.1985, ch. 38, par. 1005-8-4(a). The statute provided that, under circumstances that fit this case, "the court may enter sentences to run consecutively." (Emphasis added.)
An amendment to the statute went into effect July 1, 1988. "May" was changed to "shall." Consecutive sentencing was made mandatory. 730 ILCS 5/5-8-4(a) (West 1992).
Subsection (b) of the statute remained the same: consecutive sentences may be imposed by the court when, "having regard to the nature and circumstances of the offense and the history and character of the defendant, it is of the opinion that such a term is required to protect the public from further criminal conduct by the defendant, the basis for which the court shall set forth in the record." (Emphasis added.) 730 ILCS 5/5-8-4(b) (West 1992).
It is undisputed that the trial judge did not tell McCleary he had the right to be sentenced under the law as it existed at the time of the offenses. Before passing sentence, the trial judge said:
"I've observed your demeanor and the way you acted since you have been assigned to this courtroom. I've seen the progress when you got your glasses, and I've read some of the motions and letters that you've given to me. And I'm impressed with your conduct right now. I'm not going to give you the maximum. This is almost on the 50th anniversary of D-Day and the landing of Normandy. You served your country. What I will do, though, and I think is mandated by law, or my opinion of what the law is, I'll have to sentence you on Count 1 to fourteen years in the Illinois Department of Corrections. How many days does he get credit for?
MR. KING: I have to calculate it. He's been in custody.
THE COURT: That's why I'm asking you the amount of days. And on Count 2 I'm going to sentence you to fourteen years in the Illinois Department of Corrections. That's going to be consecutive to Count 1." (Emphasis added.)
The statutory range for voluntary manslaughter, both at the time the offenses were committed and at the time of sentencing, was four to 15 years. It was 15 to 30 years if an extended term were imposed.


*24 OPINION


1. The Sentencing Hearing
A defendant is entitled to be sentenced in accord with the law in effect at the time of the offense. People v. Bosley (1990), 197 Ill.App.3d 215, 220, 143 Ill.Dec. 201, 553 N.E.2d 1187; People v. Clodfelder (1988), 176 Ill.App.3d 339, 125 Ill.Dec. 764, 530 N.E.2d 1173.
If McCleary's sentences were based on the 1988 amendment to section 5-8-4(a) they would run afoul of the constitutional prohibition against ex post facto laws. People v. Ostrowski (1920), 293 Ill. 91, 127 N.E. 379.
Whether McCleary was given the right to elect which law he would be sentenced under is not a serious issue. There would be no reason to choose the statute that virtually guaranteed consecutive sentences. The failure of the trial judge to state which sentencing law he was using relates to the more important question: whether the trial judge believed he was required to impose consecutive sentences. If he believed that he was, he would have been mistaken and the error would be of constitutional dimension.
The State contends that the trial judge understood his sentencing discretion under the 1986 statute. The State believes the trial judge was using subsection 5-8-4(b) to impose the consecutive sentences. That provision would have authorized the trial judge to impose consecutive sentences for the 1986 offenses.
During the sentencing hearing, the State points out, the prosecutor referred to the defendant's criminal history and the nature of the crimes when asking that consecutive sentences be imposed. True, but there is nothing in the judge's comments that indicated he was basing the sentences on subsection 5-8-4(b). Nothing about the need "to protect the public from further criminal conduct by the defendant * * *." In fact, before imposing sentence, the trial judge praised the defendant for his demeanor in court and his service to his country.
The record of the sentencing hearing does not provide an answer to our conundrum. The only way to find out is to return the case to the trial judge for resentencing.

2. Waiver of the sentencing issue
The defendant failed to raise the sentencing issue either at the time of sentencing or in a motion to reconsider. The State, citing subsection 5-8-1(c) (730 ILCS 5/5-8-1(c) (West Supp.1993)), contends he has waived the issue for purpose of appeal.
Subsection 5-8-1(c) was amended on August 11, 1993, before the sentencing in this case. Until the change, the pertinent part of the statute provided:
"A motion to reduce a sentence may be made, or the court may reduce a sentence without motion, within 30 days after the sentence is imposed * * *." (Emphasis added.) Ill.Rev.Stat.1989, ch. 38, par. 1005-8-1(c).
The Supreme Court held the language of the statute was permissive. No motion to reduce was required of a defendant who wished to appeal the severity of his sentence. People v. Lewis (1994), 158 Ill.2d 386, 199 Ill.Dec. 664, 634 N.E.2d 717.
The 1993 amendment, which applies to this case, added:
"* * * A defendant's challenge to the correctness of a sentence or to any aspect of the sentencing hearing shall be made by a written motion filed within 30 days following the imposition of sentence * * *." (Emphasis added.)
It is apparent that the legislature intended to make the written motion mandatory for appeal. See People v. Williams (1991), 143 Ill.2d 477, 484, 160 Ill.Dec. 437, 577 N.E.2d 762 (use of the word "shall" is generally indicative of a mandatory intent).
The State contends the amendment requires us to say any error in sentencing was waived by the defendant's inaction.
That will be true in most cases. Not all. Not this one.
Supreme Court Rule 615 provides:
"Plain errors or defects affecting substantial rights may be noticed although they were not brought to the attention of the trial court." 134 Ill.2d R. 615(a).
*25 Sentencing issues are regarded by courts as matters affecting a defendant's substantial rights, "and, thus, have been excepted from the doctrine of waiver." People v. Burrage (1994), 269 Ill.App.3d 67, 77, 206 Ill.Dec. 450, 645 N.E.2d 455. Clearly, the right to be sentenced according to law is a substantial right.
We have held that the "erroneous imposition of an extended term sentence on a defendant affects his fundamental right to liberty * * *." People v. Askew (1995), 273 Ill. App.3d 798, 806, 210 Ill.Dec. 65, 652 N.E.2d 1041. No less can be said about a sentence based on judicial misconception of applicable law.
We do not read the amended statute as an attempt to deprive this court of all power to review sentences. Such a reading would violate the Supreme Court's authority to fashion rules governing appeal, and "encroaches upon judicial power and thereby violates the separation of powers clause of our constitution." In re C.R.H. (1994), 163 Ill.2d 263, 275, 206 Ill.Dec. 100, 644 N.E.2d 1153 (provision of Juvenile Court Act providing for automatic waiver on appeal of right to parental notice if timely objection not made violated separation of powers clause of Illinois constitution). Also see People ex rel. Stamos v. Jones (1968), 40 Ill.2d 62, 237 N.E.2d 495; People v. Riley (1991), 209 Ill.App.3d 212, 154 Ill.Dec. 74, 568 N.E.2d 74.
If the trial judge in this case believed the statute required him to impose consecutive sentences he committed plain error. We do not hold he must have held that belief. He may have very clearly understood his discretionary powers. But the record is ambiguous. Guesswork would not be appropriate where personal liberty is at risk.

CONCLUSION
For the reasons stated, we vacate the sentences imposed on the defendant and remand this cause for resentencing. We express no view on what those sentences should be.
VACATED AND REMANDED.
BUCKLEY and BRADEN, JJ., concur.
