The Senate on Thursday adopted a package of surveillance reforms its backers say will help rein in abuses, following an inspector general report that found fault with the FBI’s handling of an investigation into a former Trump campaign aide.

The 80-to-16 vote paves the way for final House passage of the bill to renew the USA Freedom Act. The Democratic House leadership is assessing when to take it up, an aide said.

The law expired in mid-March, leaving the FBI without several surveillance tools it considers crucial, but the bureau was able to continue to use those powers in investigations that had already been opened.

The bill had become a flash point for conservatives angry at the FBI’s handling of an investigation into a former Trump campaign adviser, Carter Page, that involved wiretap order applications that the Justice Department inspector general in December found were marred by errors and omissions.

At the same time, liberals, who have been critical of the surveillance process since long before the Page controversy erupted, have seen the bill as a vehicle to push for deeper surveillance reforms to protect civil liberties.

The House had passed the original package in March, but when the Senate finally took it up this week, it amended the bill to strengthen third-party oversight of the process used to obtain court approval for wiretaps and searches in espionage and counterterrorism investigations under the Foreign Intelligence Surveillance Act, or FISA. The House must now take up the Senate version.

Sponsored by Sens. Mike Lee (R-Utah) and Patrick J. Leahy (D-Vt.), the amendment requires judges with the Foreign Intelligence Surveillance Court, which decides whether to authorize surveillance, to appoint an amicus, or third-party observer, in any case involving a “sensitive investigative matter” as long as the court does not determine it to be inappropriate. The reform also would give the court and the amicus access to all information related to the surveillance application.

The bill also permanently bans a controversial but dormant program that allowed the National Security Agency to obtain Americans’ phone records in FBI counterterrorism investigations.The agency suspended the program in early 2019.

In March, three FISA authorities lapsed. One is Section 215 of the USA Patriot Act, which allows the government to obtain “any tangible thing” — from airline travel records to genetic profiles to online purchase histories — without a probable-cause warrant as long as it asserts the information is “relevant” to a national security investigation. Another power allows the FBI to surveil a non-U.S. “lone wolf” suspect who might be planning a terrorist attack but who cannot be linked to a foreign terrorist organization. Finally, the “roving wiretap” authority enables the FBI to seek a wiretap order for a criminal suspect and continue using it even if the suspect switches phones.

The legislation bars the collection of cell tower and GPS data without a warrant. But privacy advocates have decried, among other things, the lack of an explicit ban on the government collecting Americans’ Web browsing history without a warrant.They also criticized a provision that creates a carve-out for “national security” in a new obligation to notify targets of surveillance when the government is using information against them in legal proceedings gathered under Section 215.