fix predict and residual declaration