Fixes upper bound calculation.