Fix small BSON related memory leaks.
Fix behavior of Jacobian recalculation in Newton.