When it issued its first two estimates, the IRS wasn’t looking at a broad enough timeframe to understand the full scope of the data breach. The first estimate, released in May 2015, only revealed 114,000 instances of unauthorized access, and 111,000 failed attempts to access tax records. In August, the agency examined the entirety of the 2015 tax-filing season, and found that hackers had accessed records an additional 220,000 times, and made a further 170,000 failed attempts.

Finally, on Friday, the agency said the latest investigation—this one conducted by the office of the IRS inspector general rather than the agency itself—found 390,000 more cases of unauthorized access, and 295,000 more accounts that were targeted but not breached.

The hackers bested the “Get Transcript” application by assuming others’ identities and tricking it into divulging tax history. They used details about real taxpayers that they compiled separately—likely bought off of other criminals who had previously stolen massive amounts of sensitive information from other places—to convince the system that they were authorized users logging in to download an official document.

It’s not a foregone conclusion that hackers stole information from all 724,000 accounts that were accessed. But they certainly did profit off of some of them: In May, the IRS said the hackers filed about $50 million in fraudulent tax returns.

The agency will mail notices to the taxpayers whose accounts were compromised starting next week, and will offer them one year of free identity-theft protection services. (The taxpayers whose accounts hackers unsuccessfully attempted to access will also receive a notification, though they won’t be offered the identity-theft protection plan.)

The IRS’s trouble determining the scale of cyberattacks was mirrored at another federal agency last year.

When hackers connected to China made their way into systems that belonged to the Office of Personnel Management, the agency’s initial damage report was harrowing: Officials said the intruders made off with 4.2 million individuals’ sensitive personal information. But then, as the breach was being investigated, another, much larger intrusion was discovered.

OPM Director Katherine Archuleta had learned her lesson about speaking too soon. Even as she was harangued by a Congress eager to learn the full extent of the breach, she did not announce the scale of the intrusion until a long investigation had been completed. Finally, in June, OPM announced that a total of about 22 million people were affected by one or both hacks. It took until December for all the people affected by the hack to be notified by mail.

As cyberattacks like the IRS and OPM hacks become a standard part of doing business, organizations are searching for new ways to detect and prevent them. Strong defenses can help keep most intruders out, and for the data that does leak, complex web crawlers can send alerts whenever private, sensitive data pops up for sale on a hacker forum or the dark web.

And with better forensics tools and alerts, companies and agencies can avoid embarrassing lowball estimates after the inevitable data breach hits.