Cost (Tax) Basis Calculation from Final K1 in Section L

I read the forums from prior years on how to calculate cost (tax) basis from Final K1 in Section L. It looks like the cost basis is ALWAYS zero if the ending capital balance is zero. I have a problem with this. I have invested in a real estate LLC (limited partnership) for years ago. I have never received any distributions until the sale. The amount of distribution was less than my initial capital contribution. Although I lost money in this partnership, my cost basis is zero makes it look like  I have capital gains. How is this possible?

 

Here is the Section L from my final K1:

 

Beginning Capital Account: 23654

Capital Contributed During Year:  0

Current Year Net Income (Loss): -2748

Other Increase (Decrease): -618

Withdrawals &Distributions: 20288

Ending Capital Account: 0

 

I believe my cost basis should be $23654 - $618 =$23036 and my sale price should be $20288. Hence, I should incur a capital loss.