fix inverse calculation.