
139 P.3d 773 (2006)
143 Idaho 171
Willard G. FULLMER, Petitioner-Appellant,
v.
Bea COLLARD and Carolee Kelly, Respondents.
No. 31554.
Court of Appeals of Idaho.
June 15, 2006.
Willard G. Fullmer, Boise, pro se appellant.
*774 Hon. Lawrence G. Wasden, Attorney General; Timothy R. McNeese, Deputy Attorney General, Boise, for respondents.
LANSING, Judge.
In this prisoner habeas corpus case, Willard Fullmer claims that Bea Collard and Carolee Kelly, who are sentencing specialists at the Idaho Department of Correction,[1] have miscalculated the sentence completion date for one of his sentences. We agree. We therefore reverse the trial court's order denying Fullmer's petition.

I.

BACKGROUND
This case involves the interaction of consecutive sentences for the crimes of sexual abuse and escape, and a resentencing on the escape charge. To give context to our discussion, before we delve into the details of Fullmer's sentences, a brief overview of pertinent sentencing laws and regulations is in order.
Under Idaho law, a sentence of imprisonment for a felony generally consists of two parts, the fixed term (also sometimes referred to as the determinate term or minimum term), which is the minimum period that a defendant must serve before becoming eligible for parole, and a subsequent indeterminate term, during which the defendant may be released on parole. See Idaho Code § 19-2513. A prisoner must receive credit on a sentence for any period of incarceration prior to the entry of judgment if such incarceration was for the offense for which the judgment was entered. I.C. § 18-309. This credit is given by subtracting the number of days' credit from the end of the fixed term of the prisoner's sentence, or from the final release date if no fixed term applies to the sentence. IDOC Directive 136.07.01.00.
When the defendant has committed multiple offenses, a sentencing court may order that the sentences will be served concurrently or consecutively. I.C. § 18-308. When consecutive sentences have been imposed, a prisoner first serves the fixed term of the first sentence, then the fixed term of the second sentence, followed by the consecutive indeterminate portions of each sentence. Doan v. State, 132 Idaho 796, 799, 979 P.2d 1154, 1157 (1999). See also IDOC Directive 136.07.02.00 (regarding consecutive sentences, "[m]inimum terms of confinement must be served one (1) after the other and cannot be served at the same time. An offender becomes parole eligible on all sentences when all minimum terms of confinement have been served"). By statute, the service of a sentence for escape must run consecutive to the sentence the prisoner was serving when he escaped. I.C. § 18-2505. See also Doan, 132 Idaho at 801, 979 P.2d at 1159; State v. Mendenhall, 106 Idaho 388, 393, 679 P.2d 665, 670 (Ct.App.1984).
In the present case, Fullmer was sentenced for sexual abuse on June 30, 1998. He received a unified sentence of seven years with one year fixed, with credit for five days of prejudgment incarceration. While serving that sentence, Fullmer escaped from custody, but was rearrested three days later. He was ultimately convicted of escape, for which he received a unified sentence of five years with two years fixed, to run consecutive to the sexual abuse sentence. He received 109 days of credit on the escape sentence for prejudgment incarceration.
Thus, Fullmer was to serve the fixed portion of the sexual abuse sentence from June 30, 1998 to June 27, 1999,[2] followed by the fixed portion of the escape sentence from June 28, 1999 to March 10, 2001. Fullmer would then be eligible for parole, but could remain incarcerated through the indeterminate portion of the sexual abuse sentence from March 11, 2001 to March 10, 2007 and the indeterminate portion of the escape sentence from March 11, 2007 to March 10, 2010. The following table summarizes the interaction of the sentences as originally imposed.


*775
                                    Sexual Abuse Charge             Escape Charge
   Date Sentenced                   June 30, 1998                   November 23, 1998
   Unified Sentence                 7 years                         5 years
   Determinate Portion              1 year                          2 years
   Indeterminate Portion            6 years                         3 years
   Credit for Time Served           2 days                          109 days
   Dates of Determinate Portion     June 30, 1998-June 27, 1999     June 28, 1999-March 10, 2001
                                    (1 year less two days)          (2 years less 109 days)
   Dates of Indeterminate Portion   March 11, 2001-March 10, 2007   March 11, 2007-March 10, 2010
                                    (6 years)                       (3 years)

On the same day that sentence was imposed for the escape charge, Fullmer was also sentenced in three other cases, which we will refer to collectively as "the drug cases." The longest of those sentences (after a subsequent modification by the trial court) was a unified seven-year sentence, with two years fixed and five years indeterminate. All of these sentences in the drug cases were to be served concurrently with the sexual abuse sentence. These drug case sentences have little bearing on this appeal.
On November 25, 1998, while serving the fixed portion of his sexual abuse sentence, Fullmer filed a petition for post-conviction relief relating to the escape case. Apparently as a result of that post-conviction action, on October 30, 2000, the district court resentenced Fullmer on the escape charge. The court re-imposed the same unified sentence of five years with two years fixed, to run consecutive to the sexual abuse sentence, but significantly, the court also directed that Fullmer be given credit "for time served" in the amount of 814 days in the escape case. This number was apparently intended to be the aggregate of the one-hundred and nine (109) days that he was originally credited plus the seven hundred and five (705) days he had been incarcerated since filing his post-conviction petition on November 25, 1998. Despite this change in the sentence, granting additional credit for time served, IDOC continued to calculate Fullmer's escape sentence with a full-term release date of March 10, 2010.
Fullmer filed a pro se petition for a writ of habeas corpus, arguing that he was being deprived of liberty without due process because IDOC did not properly credit him for the 814 days. The magistrate court conducted a hearing at which IDOC and Fullmer both presented their sentence calculations, and ultimately dismissed the petition on the ground that IDOC's calculation was correct. The district court affirmed this decision on intermediate appeal. For the reasons explained below, we reverse and direct that Fullmer be credited on his escape sentence as ordered by the district court at resentencing.

II.

ANALYSIS
It has oft been said that the dismissal of a petition for a writ of habeas corpus is reviewed for an abuse of discretion. Johnson v. State, 85 Idaho 123, 127, 376 P.2d 704, 705 (1962); Brennan v. State, 122 Idaho 911, 914, 841 P.2d 441, 444 (Ct.App.1992). See Brandt v. State, 126 Idaho 101, 103, 878 P.2d 800, 802 (Ct.App.1994). A permissible exercise of discretion occurs, however, only if the trial court acts within the outer boundaries of its discretion and consistently with applicable legal standards. Brennan, 122 Idaho at 914, 841 P.2d at 444. Therefore, an abuse of discretion will be found if the trial court's findings of fact are not supported by substantial evidence or if the trial court does not correctly apply the law. Quick v. Crane, 111 Idaho 759, 772, 727 P.2d 1187, 1200 (1986); Margairaz v. Siegel, 137 Idaho 556, 558, 50 P.3d 1051, 1053 (Ct.App.2002).
The issue here is how to properly apply 814 days that the sentencing court credited to Fullmer on the escape charge upon resentencing on October 30, 2000. With that credit given, the two-year fixed portion of the escape sentence was already satisfied as of the date of resentencing. The two-year fixed term consumed 730 days of the credit, leaving 84 days to be credited against the indeterminate portion of the sentence. Because the fixed term of the escape sentence was thus satisfied, there would be no interruption *776 between service of the fixed portion and the indeterminate portion of the sexual abuse sentence, and upon completion of the indeterminate portion of the sexual abuse sentence, the remaining indeterminate portion of the escape sentence (after application of the 84 days' credit) would begin to run. The following table presents this application of the 814 days' credit as ordered by the district court on resentencing:


                                    Sexual Abuse Charge           Escape Charge
   Date Sentenced                   June 30, 1998                 October 30, 2000
   Unified Sentence                 7 years                       5 years
   Determinate Portion              1 year                        2 years
   Indeterminate Portion            6 years                       3 years
   Credit Time Served               2 days                        814 days
   Dates of Determinate Portion     June 30, 1998-June 27, 1999   2 years (730 days) credited
   Dates of Indeterminate Portion   June 28, 1999-June 29, 2005   June 30, 2005-April 5, 2008
                                                                  (3 years less 84 days credited)

This results in a full-term release date of April 5, 2008, which is precisely the date asserted by Fullmer in his petition.
It is difficult for this Court to distill or articulate IDOC's analysis of how the sentences should be served, for IDOC's appellate brief does not express that computation. IDOC did present in the trial court several distinct approaches on how to treat the credit given on resentencing. All of IDOC's approaches are consistent, however, in ultimately allowing none of the new credit, thereby leaving Fullmer with the same full-term release date that he had under the original sentences. For example, in an "account of days incarcerated" prepared by IDOC and introduced as an exhibit at the hearing, IDOC purports to give credit for the full fixed portion of the escape sentence, thus accelerating Fullmer's parole eligibility date, but when moving to the indeterminate portion of that sentence, IDOC uses five years, which is the full unified sentence, as the indeterminate term instead of the three-year indeterminate term imposed by the trial court, thus entirely reversing the effect of the credit given against the fixed term. As best we can discern, IDOC treats the credit granted by the trial court on the resentencing for escape as an instruction to reapportion the credit to the proper sentence. IDOC argues that in giving Fullmer credit for 814 days on the escape offense, the sentencing court erred because Fullmer had not yet served that much time for escape and because the credit is allegedly duplicative of credit given on the drug case sentences.[3]
It must be acknowledged that the court at resentencing gave Fullmer credit for more time than he had actually served on the escape sentence. This is so because when Fullmer filed his post-conviction action in November 1998, and continuing until June 27, 1999, he was still serving the fixed term of the sexual abuse sentence; from June 28, 1999 until resentencing in October 2000, Fullmer served only 490 days on his escape sentence. Thus, the sentencing court credited Fullmer as if he had been serving the escape sentence concurrently with the sexual abuse sentence from November 1998 onward.
Even if the sentencing court erred, however, IDOC is not justified in refusing to apply the credits as ordered by the court. It is not IDOC's prerogative to determine when a sentence is erroneous and simply make corrections accordingly. If a trial court imposes a sentence that is not in compliance with Idaho law or is otherwise mistaken, the State may seek correction from the sentencing court in the criminal action or may take an appeal from the sentence. The State did neither in this case; instead, IDOC resorted *777 to the self-help remedy of reassigning the credit ordered by the trial court in such a way as to leave Fullmer with the same full-term release date.
There is little doubt that IDOC's action has not only contravened the literal words of the escape judgment as amended upon resentencing, but also frustrated the sentencing court's intent to reduce Fullmer's overall period of imprisonment. From the transcript of the resentencing hearing it is apparent that the court intended to reduce Fullmer's cumulative sentences. During that hearing, Fullmer requested that the district court craft his sentences so he could be released from maximum security incarceration to a medium security facility, where he could access several rehabilitative programs. In order to achieve this, the cumulative sentences needed to be less than ten years, which is the result accomplished by the credit given. The district court addressed Fullmer's request by stating that it intended to amend the sentence for the escape and by indicating that the court believed the new cumulative sentences "should get [him] well below the ten-year mark." If the perceived error in the sentencing court's methodology had been brought to that court's attention, the court might well have elected to correct the error and still accomplish the intended result by simply reducing the escape sentence. The sentencing court has not been given that opportunity.
In sum, regardless of whether there are errors in the modified sentence pronounced on October 30, 2000, that is the sentence that IDOC is charged with administering unless or until the sentence has been corrected by the sentencing court or by an appellate court through proper judicial proceedings. Consequently, the magistrate's order dismissing Fullmer's petition for writ of habeas corpus is reversed, and IDOC is directed to apply credit to Fullmer's escape sentence in conformity with this opinion.
Chief Judge PERRY and Judge GUTIERREZ concur.
NOTES
[1]  We hereinafter refer to Collard, Kelly, and the Idaho Department of Correction collectively as "IDOC."
[2]  Although Fullmer received five days' credit on this sentence for prejudgment incarceration, for present purposes we have reduced the credit to two days to take into account the three days that he was at large following his escape.
[3]  The State has also asserted that the escape sentence runs consecutively to all of the other sentences being served by Fullmer. That is not correct. The court's judgment clearly makes the escape sentence consecutive only to the sexual abuse sentence. The escape sentence was not made consecutive to the drug sentences, and therefore Fullmer's service of the escape sentence, beginning at the end of the fixed term of the sexual abuse sentence, overlaps to some extent his service of the drug sentences. This distinction is important because the drug case sentences have a five-year fixed term, as compared with the one-year fixed term of the sexual abuse sentence. Treating the escape sentence as consecutive to the drug sentences would thus delay commencement of service of the escape sentence for approximately four years.
