changed the gradient of the objective for SPOT and hessian