Fix computation of partial residuals in deterministic case