better handling of negative eigenvalues in Hessian