It shall be lawful for any party of whom a bond, undertaking, or other obligation is required, to agree with his or her surety or sureties for the deposit of any or all moneys and assets for which he or she and his or her surety or sureties are or may be held responsible, with a bank, savings bank, savings and loan association, safe deposit or trust company, authorized by law to do business as such, or with other depository approved by the court or a judge thereof, if such deposit is otherwise proper, for the safekeeping thereof, and in such manner as to prevent the withdrawal of such money or assets or any part thereof, without the written consent of such surety or sureties, or an order of court, or a judge thereof made on such notice to such surety or sureties as such court or judge may direct: PROVIDED, HOWEVER, That such agreement shall not in any manner release from or change the liability of the principal or sureties as established by the terms of said bond.