bugfixes to the sparse hessian with loop generation when there are also equations outside loops;