California lawmakers on Wednesday moved to deter the use of what a legislator called “junk science” in the courtroom and give those convicted with questionable expert testimony a way out of prison.

Senators approved changing the state’s definition of false testimony to include expert court opinions based on flawed scientific research or outdated technology, or where a reasonable scientific dispute has emerged over its validity.

Expert opinions that aren’t based on bona fide research, peer-reviewed studies or other science would not satisfy the state’s requirements for admissible testimony.

The bill by Democratic state Sen. Scott Wiener would allow people to appeal if they previously were convicted based on the discredited testimony.

“This bill gives judges stronger tools to prevent junk science from coming into our courtrooms,” Wiener said.

The California Innocence Project, which sought the bill along with the Loyola Project for the Innocent and the Northern California Innocence Project, said flawed forensic science occurred in 45% of DNA exonerations and 24% of all exonerations in the United States. The groups investigate such cases and advocate for the release of those who have been wrongfully convicted.

The National Academy of Science has said jurors can be thrown off by what is known as the “CSI effect,” where jurors have unrealistic expectations of the reliability of forensic evidence from watching “CSI” and similar television shows.

The bill had no formal opposition from prosecutors or other law enforcement organizations. It passed, 30-3, sending it the Assembly.

But Republican Sen. Jim Nielsen, who once headed the state parole board, said the bill is another effort by majority Democrats to ease criminal punishments.

“These are just more attempts to erode the justice system to ensure that justice for the victims of crimes do not see justice done, that individuals who have committed crimes have more venues to escape any consequences for their behaviors,” Nielsen said.

GOP Sen. Andreas Borgeas also voted against the bill, urging a different approach to what he acknowledged can be a problem.

“Even a ham sandwich could be indicted,” Borgeas said, reciting an old legal dogma. “You can get anybody to say virtually anything.”

Wiener said those whose convictions are overturned under his bill could be retried, if investigators have other evidence to prove their guilt.

“This isn’t about letting criminals get out of jail free,” he said.