The cost of improvements will indirectly offset your capital gain on the resale of your rental home as they can be added to your cost basis of the home.
Unpaid (or lost) rent isn't deductible and can't offset the capital gain. The reason is that unpaid rent was never included in your rental income.
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"