Fixes to Levenberg-Marquardt code.

Does not yet update to the style of taking a `g(x)` that mutates a storage array.
But, at least this update gets things running again.