Answer:
Contracts can be changed by agreement of the parties. The contract can have clauses that direct pricing and other items be reviewed regularly. Prices can also be based on outside measures, such as the spot price of a material on specific days. If something in the contract becomes illegal, that part of the contract will be removed or adjusted accordingly.