A Republican lawmaker wants to beef up the federal background check system for guns.

Sen. John Cornyn (R-TX) said on Tuesday, according to the Hill, that he’ll introduce a bill that will “ensure that all federal departments and agencies, including the Department of Defense, upload the required conviction records into the national database.” Cornyn argued that the number of records sent to the National Instant Criminal Background Check System (NICS) today is “staggeringly low.”

“There are enormous problems with the background check system,” Cornyn said. “This is one of those areas of consensus on a very contentious topic.”

The comments come after the Air Force admitted that it failed to submit records that may have blocked Devin Kelley, who shot and killed 26 people at a Sutherland Springs, Texas, church on Sunday, from buying guns.

Kelley should have been barred from the purchases due to a previous conviction while he was still an airman for assaulting his spouse and their child. But after Kelley was court-martialed, sentenced to 12 months confinement, and received a bad-conduct discharge, the Air Force failed to enter his record into the proper database — even though Pentagon guidelines require the Air Force to do so.

Based on these facts, this particular tragedy may have been prevented with better enforcement of existing military guidelines and federal law.

This gets to one of the fundamental problems in America’s gun laws: It’s not just that they are generally laxer than other developed countries’ laws; they are also poorly applied and enforced. This isn’t even the first time poor enforcement seemingly made a mass shooting possible — with previous failures contributing to the mass shootings at Virginia Tech in Blacksburg and a church in Charleston, South Carolina.

Cornyn’s bill attempts to patch at least one flaw in the system, although we’ll have to see the full details of his proposal to see how it will work. And like previous gun control bills, it’s an open question whether it’ll pass Congress or get President Donald Trump’s signature.

How the Air Force failed

Under federal law, Kelley should have been barred from obtaining a firearm after he was convicted of two counts for assaulting his spouse and their child. Geoffrey Corn, a former Army lawyer and professor at the South Texas College of Law in Houston, told the Washington Post that Kelley’s sentence effectively acted as a felony conviction for domestic abuse, which should have prevented him from buying a gun. But, he said, there seems to be confusion within the military about which convictions to report.

The Air Force’s failure effectively erased Kelley’s record for the purposes of a federal background check to purchase a firearm. And that seemingly allowed him to purchase guns — at least two from retailer Academy Sports, although it’s unclear if those were the guns used in the Texas shooting, according to the Post.

The Air Force will reportedly conduct a review of its “relevant policies and procedures.” But as ProPublica reported, this has been a problem for years — going back to a 2015 Pentagon report — and the problems have persisted. Cornyn’s bill could force action.

Still, it’s not just a problem in the Air Force and military.

Federal gun laws are poorly enforced

Poor enforcement is a huge problem with US gun laws.

As the Air Force situation shows, the system relies on people properly reporting to the right database. This has always been a problem — not just for branches of the military, but even entire state agencies.

In 2007, Virginia Tech student Seung-Hui Cho shot and killed 32 people and himself at his college campus. Cho was not supposed to be able to buy a gun due to a history of mental illness. But the correct records were never sent to NICS.

Since the Virginia Tech shooting, federal and state governments have taken steps to ensure more reporting is done. But as the advocacy group Giffords Law Center noted, “records of many individuals prohibited from possessing firearms because of their mental health histories are still missing from the database. The greatest gains in the numbers of state records submitted to NICS largely reflect the efforts of a small minority of states, and as of November 2013, 12 states had still submitted fewer than 100 records each.”

The federal background check system is also notoriously underfunded, understaffed, and underresourced, allowing red flags to slip through. Although there are no waiting periods under federal law, a check that turns out inconclusive can be extended for three business days for further investigation. But these three days are a maximum for the government — and sometimes, the three days lapse without the FBI completing its check, and a buyer can, at that point, purchase a gun without the completed check.

The FBI admitted that something like this happened for Dylann Roof, who killed nine people at a predominantly black church in Charleston, South Carolina, in 2015: Roof should have failed a background check for a handgun purchase after admitting to illegally possessing controlled substances in the past, but the FBI examiner did not obtain the shooter’s record in time.

The background check system is also riddled with loopholes. The most well-known problem: If someone purchases a gun from a private seller, such as a friend or family member, no background check is required. This is often mischaracterized as the gun show sale loophole, under the assumption that people can simply go to a gun show and buy a gun without getting a background check. But licensed dealers at gun shows still have to carry out a background check. The actual loophole is that someone can meet with a private seller at a gun show — or, increasingly, over the internet — and buy a firearm from that person without a background check. In other words, the gun show doesn’t create a loophole; the private seller does.

All of this makes it possible for people who shouldn’t get guns to obtain them — and as the Sutherland Springs shooting shows, this can get people killed. Cornyn, at least, now wants to take steps to remedy that.

For more on America’s gun laws and how they compare to other countries, read Vox’s explainer.