Corrected residual computation