option to return residual