correct the integral direction