diff --git a/web/components/amount-input.tsx b/web/components/amount-input.tsx
index ff6af9fe..6c42a370 100644
--- a/web/components/amount-input.tsx
+++ b/web/components/amount-input.tsx
@@ -250,7 +250,7 @@ export function SellAmountInput(props: {
Sale proceeds{' '}
{formatMoney(saleValue)}
- {prevLoanAmount && (
+ {!!prevLoanAmount && (
Loan repaid{' '}
diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx
index 009bf1dc..075439b8 100644
--- a/web/components/bet-panel.tsx
+++ b/web/components/bet-panel.tsx
@@ -364,7 +364,7 @@ function SellPanel(props: {
const initialProb = getProbability(contract)
const { newPool } = calculateCpmmSale(contract, {
- shares: amount ?? 0,
+ shares: Math.min(amount ?? 0, shares),
outcome: sharesOutcome,
})
const resultProb = getCpmmProbability(newPool, contract.p)