Meta Platforms (META  ) announced changes to its advertising algorithms as part of a settlement with the Department of Justice to settle accusations of allowing landlords to discriminate when marketing their properties.

According to the DoJ, Meta's advertising systems had been designed in a way that could restrict housing advertisements from being seen by users of a specific race, gender, or religion. The algorithm would use what are considered "protected characteristics" to present ads to those who appeared to be most in line with the advertiser's targeted audience.

This rather overt selection bias puts Meta in violation of the Fair Housing Act, according to the New York District Court that heard the case, as the company's advertising technology "deprives users of housing opportunities based in whole or in part on protected characteristics." The court's decision marks the first time Meta's advertising business has been subjected entirely to government-mandated oversight through a court order.

Meta has taken the settlement in stride and has quickly enacted changes to its advertising algorithms, according to its press release.

"To protect against discrimination, advertisers running housing ads on our platforms already have a limited number of targeting options they can choose from while setting up their campaigns, including a restriction on using age, gender, or ZIP code," Meta wrote. "Our new method builds on that foundation and strives to make additional progress toward a more equitable distribution of ads through our ad delivery process."

Meta's advertising business has had a rough run of luck lately, starting the year with a kneecapping by Apple's (AAPL  ) privacy changes, giving consumers a one-tap option to protect their data. The company's flagship product, Facebook, is slowly losing its market share of the social media space as younger consumers flock to more popular apps such as Tik Tok.

The settlement is certainly a negative development for Meta, but it is far from the kind of blows the company has suffered to its ad business throughout the year. Meta's quick response and changes to its advertising business should help resolve the matter relatively quickly and without too many headaches for shareholders.