(a) Upon a mandate of reversal ordering a new trial being filed in the clerk's office of the circuit court in which the judgment of confinement in the Department of Correction was rendered and executed, the clerk shall deliver to the county sheriff a copy of the mandate and precept, authorizing and commanding the county sheriff to bring the defendant from the department to the county jail, which shall be obeyed by the county sheriff and Director of the Department of Correction.
(b) If the defendant is again convicted upon the new trial, the period of his or her former confinement in the department shall be deducted by the circuit court from the period of confinement fixed in the last verdict of conviction.