fixed off-by-one in hessian calculation