pimped the computation of the error and the jacobian