Fix algorithm contract.