No bail undertaking shall be discharged by reason of the want of the qualifications required in this chapter, by reason of there not being the requisite number of bail, by reason of any agreement other than is expressed in the undertaking, by reason of the infancy, coverture, lunacy or any other incapacity of any of the other parties thereto, because the defendant has not joined in the same or because the undertaking of bail is taken and approved by the sheriff or his deputy, where the defendant is released from custody on approval of such undertaking of bail.