Fix hessian, hessianProduct and hessianProduct' and add a doctest to try to prevent it in the future