Waiver of loans: accounting treatment and tax implications