Fix hessian generation bug