fixed error in the exponent logic