fix resid