Section 24. No person who has been discharged upon a habeas corpus shall be again imprisoned or restrained for the same cause, unless indicted therefor, convicted thereof, or committed for want of bail by a court of record having jurisdiction of the cause; or unless, after a discharge for defect of proof or for some material defect in the commitment in a criminal case, he is again arrested on sufficient proof and committed by legal process.