fix residual and pull