Germany’s biggest bank posted a loss of nearly $3.5 billion in the second quarter, slammed by the cost of a radical overhaul aimed at returning the company to profit.

Deutsche Bank took a charge of €3.4 billion ($3.8 billion) in the quarter, leading to a net loss of €3.1 billion ($3.46 billion).

Without the restructuring cost, it would have reported a net profit of €231 million ($257.4 million), down 42% on the same period last year, it said in a statement.

The bank said earlier this month that it was planning to cut 18,000 jobs and dramatically shrink its investment bank, shuttering its equities sales and trading business, while cutting back its rates division.

Deutsche Bank says it will be cutting jobs at Cary tech hub

Among those cuts are 50 positions to be eliminated at the bank’s software development and tech outpost in Cary.

CEO Christian Sewing has described the plans “as nothing short of reinventing” Deutsche Bank. When the overhaul was unveiled on July 7, the bank said it expected to sink to a loss of €2.8 billion ($3.1 billion) in the second quarter.

With Cary jobs picture still unclear, Deutsche Bank makes last-ditch effort to save itself