fixed mathematical logic of integration