This section does not restrict the power of a court of proper jurisdiction to permit a trustee to deviate from the terms of a will, agreement, court order, or other instrument relating to the acquisition, investment, reinvestment, exchange, retention, sale, or management of trust property.