The National Security Agency says that it began deleting “call detail records” in May after it determined that some of the information provided by telecoms included information that it wasn’t authorized to use. The New York Times says that the number of records is in the “hundreds of millions.”

The agency says that the records date back to 2015, and that it began to delete the records on May 23rd, after realizing the records were contaminated with additional data that it wasn’t authorized to use — call and text data from people who never connected with people the agency had targeted for surveillance. The agency says that it was “infeasible to identify and isolate properly produced data,” and opted to destroy the records.

The NSA’s general counsel, Glenn S. Gerstell, told The New York Times that the problem stemmed from “one or more” unnamed telecoms providing too much information due to “several complex technical glitches.” He says that the NSA has since worked with the companies to correct the issue.

The NSA was authorized to collect phone and text records from telecoms under the 2001 Patriot Act to try to find terrorism suspects. But despite provisions that reined in the agency’s bulk collection with the 2015 USA Freedom Act, the agency collected more than 151 million records in 2016 and 534 million records in 2017. The agency’s secret data collection program was exposed by a former contractor named Edward Snowden in 2013, prompting uproar from privacy advocates, and prompted the creation of the 2015 law.