test fixes, and use solve(hess, grad) for better stability