Modified jacobian of output function and tried to reduce numerical error