added residual check for mlr