fixed issue's with residual values being incorrectly altered.

Signed-off-by: Chris Jones <chris@jonezy.org>
Merge branch 'calc-fixes'
Merge branch 'master' into config-province-tracking