The endog y variable needs to be zero, one. However, in other cases, it is possible that the Hessian is not positive definite when we evaluate it far away from the optimum, for example, at bad starting values. Switching to an optimizer that does not use the Hessian often succeeds in those cases. For example, scipy's 'bfgs' is a good optimizer that works in many cases.