no, no. That isn't how it works, you're confused.
Look at it like this:
Fact pattern a
1) You paid 100,000 for your house plus improvements you just mentioned
2) You sell it for 135,000
Fact pattern b
1) you paid 100,000 for your house plus improvements you just mentioned
2) you sell it for 90,000
In situation A you owe the rest of the payback on the credit. You made 35,000 on the sale of your home. You won't pay tax on that sale if it's been your primary home for two years and you haven't sold one in the last 5.
In situation B you don't owe the credit because you lost money on the sale, 10,000.