fixed bugs in jacobian computation