Bottom line: Wells Fargo has to pay the price for allegedly faulty software that caused the bank to illegitimately foreclose on hundreds of homes. The borrowers should have been granted loan modifications, but instead were rejected by the automated program. Nearly two-thirds ended up losing their homes.

According to a filing with the federal Securities and Exchange Commission (SEC), the mortgage lender has allocated $8 million to compensate homeowners who were erroneously foreclosed on due to a “glitch” in a software system used to handle mortgages. The errors occurred between April 2010 and October 2015 on some accounts that had been undergoing foreclosure proceedings.

Nearly 625 account holders had applied for mortgage modifications that they were qualified for but were auto-rejected by the software. Of those, 400 ended up getting foreclosed upon unjustly.

The same filing also indicates that the bank is currently under investigation by unnamed government agencies. The probes are linked to Wells Fargo’s "financing of low-income housing developments" in which it received tax credits. While WF’s filing does not mention who is doing the investigating, Reuters reports that officials from the Internal Revenue Service, the Federal Housing Finance Agency, and the US Department of Housing and Urban Development are involved.

"The $8 million accrual is intended for roughly 625 borrowers who should have qualified for a loan modification under a program the Treasury Department set up in 2009 to help Americans who were struggling to make mortgage payments."

Wells Fargo has been caught in several scandals recently and over the years that have cost the company billions in revenue.

According to CNN, just last week the bank was handed a $2.1 billion fine by the Justice Department for approving mortgage loans that knowingly contained incorrect income information. The DoJ insists that this irresponsible action helped contribute to the 2008 housing collapse.

Back in June, the lender was accused by the SEC of taking advantage of investors by “improperly encouraging” them to trade off debt products (for a high fee) that were meant to be held to maturity. Wells Fargo didn’t officially admit to or deny any wrongdoing but did agree to pay a $4 million penalty over the alleged misconduct along with returning over a million dollar to investors.

Other scandals the bank has been involved in include the creation of fake accounts to boost sales figures in 2016, applying “unfair mortgage fees,” and charging customers for car insurance that they did not require.

Wells Fargo and the involved agencies have declined requests for comment.