Any difference between the book value loss (or gain) and the cost of modification is recognized as a gain or loss.
Whatever the difference between a book value loss and cost of modification, it is a loss.