bugfixes to the sparse hessian with loops generation;
new test cases for the hessian with loops