How did a Wells Fargo computer glitch force foreclosure on 400 homes? What does it mean for mortgage loans and the real estate industry?

Wells Fargo has faced scandal after scandal for bad business practices, including creating fake customer accounts to boost sales figures, charging unfair mortgage fees and charging customers for car insurance they didn’t need. Just this past week, Wells Fargo paid more than $2 billion for fines and settlements over separate incidents.

Investors lost billions of dollars from mortgage-backed securities that contained Wells Fargo loans, and the government believes this contributed to the 2008 financial crisis that crippled the global economy.

“Today’s agreement holds Wells Fargo responsible for originating and selling tens of thousands of loans that were packaged into securities and subsequently defaulted,” said Alex Tse, acting U.S. Attorney for the Northern District of California, in a statement.

This week, news broke on a regulatory filing about a computer glitch that denied qualified customers loan modifications between 2010 and 2015. An underwriting tool apparently miscalculated attorneys’ fees and disqualified customers from a federal assistance program. More than 600 customers were affected.

To make matters even worse, 400 of those customers had their homes foreclosed on as a result of the glitch. Wells Fargo still faces “formal or informal inquiries and investigations” from unnamed government agencies on how the company purchased federal low-income housing tax credits.

The bank has launched a massive ad campaign on radio, television and online talking about how the bank has gone back to its roots in an attempt to clean up its public image and regain customers trust. Wells Fargo profits, loans, deposits and revenue all shrank last quarter.

Nonetheless, thanks to a big dividend hike and stock buybacks Wells Fargo stock gained 17 percent, the second-best among 24 major U.S. lenders.