added an automatic back-calculation to fix the sum of errors whenever we set new gains.