Fix possible overflow in rounding