Fixing a bug related to dxi_dx calculation
Fixing another bug for dxi_dx