Fix integral function