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