Facebook CEO Mark Zuckerberg “saved tens of millions of dollars” by selling his Facebook stock before the company’s decline this week.

“Facebook Inc. Chief Executive Mark Zuckerberg saw his net worth decline by about $5 billion Monday, but it could have been worse,” reported Market Watch on Tuesday. “Ahead of Facebook’s worst one-day decline since 2012, prompted by news that data affecting 51.3 million members was improperly shared with a political consulting firm, Zuckerberg had been busy selling stock. So far this year, he has sold nearly 5 million shares.”

“Disposing of those Facebook shares before Monday ended up saving about $40 million, according to Securities and Exchange Commission filings and some arithmetic by MarketWatch. At Monday’s close, the 4.9 million shares Zuckerberg has sold this year under a predetermined plan would be worth $855 million,” they continued. “Zuckerberg made about $900 million selling those shares, according to calculations using average weighted prices reported to the Securities and Exchange Commission.” Zuckerberg’s stock sales were planned transactions on file with the SEC, reportedly to fund his charitable foundation.

Facebook’s stock declined by almost seven percent on Monday following allegations that the company mishandled user data from the platform.

The controversy resulted in an emergency meeting with employees of Facebook, the resignation of Facebook’s data security chief, and a pending investigation from the Federal Trade Commission (FTC).