It’s open season on the nation’s inspectors general, or so it seems. In the span of weeks, President Trump has ousted several IGs — most recently Steve Linick at the State Department, who was investigating questionable arms sales to Saudi Arabia and Secretary of State Mike Pompeo’s possible use of official staff to perform personal chores. Has Trump killed the IG system? He removed Michael Atkinson last month from his position as inspector general for the intelligence community — possibly for notifying Congress about the Ukraine whistleblower — and, on May 15, pushed out the acting inspector general at the Transportation Department. He has ousted officials in similar roles at the Defense Department and the Department of Health and Human Services.

We’ve belatedly discovered that the supposed autonomy of inspectors general — semi-independent officials who scour governmental agencies for waste and fraud — relied too heavily on presidential self-restraint, a quality Trump is not known for. “If cabinet members can remove IGs who are investigating them, and presidents can summarily dismiss IGs simply because they were appointed by a predecessor, it completely guts the point of the law,” tweeted David Axelrod, an Obama administration adviser. After all, how much waste, fraud and abuse can inspectors general uncover when their irksome inquests cost them their jobs?

But it would be premature to conclude that the system has become utterly unworkable or that inspectors general can no longer serve as a check on the executive branch. Trump’s firings, while unusual, reflect long-standing tensions over the roles of IGs within agencies, rather than a radical disjuncture. And Trump himself has often found independent IGs useful — at the Justice Department, for example. Most presidents do.

Nor has Trump broken any laws, as some critics charge. Rather, he has exploited weaknesses in the Inspector General Act, ones that Congress should now fix.

Passed in the wake of Watergate, the 1978 law was intended to improve integrity and accountability in the executive branch. Today, more than 70 inspectors general help ensure that money is properly spent, contracts properly awarded and laws properly honored and implemented. In short, they help confirm that federal laws are being faithfully executed, as the Constitution requires of the president.

Though they are part of departments and agencies, departmental and agency heads typically cannot fire them. (There are exceptions at some small agencies.) They can therefore investigate and find wrongdoing without fear of retribution by those leaders; IG offices are the governmental equivalent of police department “internal affairs” units. Little wonder that they are often viewed by higher-ups with suspicion, distrust and anger.

Members of Congress love the IGs because they often can carry out the sort of investigations that lawmakers find it difficult, if not impossible, to conduct. By law, departmental documents have to be made available to inspectors general; in contrast, Congress often has trouble securing the same material from an increasingly intransigent executive branch. To use a metaphor that would surely enrage Trump, Congress and the American public effectively have 70-plus moles in the executive branch, which makes it easier for lawmakers to conduct oversight.

The fly in the ointment is — and has always been — the presidency. Federal law allows presidents to remove most inspectors general at will. They have to notify Congress and wait 30 days for the ouster to take effect. But this constraint hardly matters: It’s an alarm bell that does nothing to stop the fire but simply gives Congress the chance to react, with complaints and possibly hearings.

Vexed that he inherited numerous IG’s appointed by President Barack Obama, Trump has proved happy to oust them. But he is hardly the first president to tangle with these pesky officials. Republicans and others accused Obama of firing Gerald Walpin, the inspector general of the Corporation for National Community Service, for political reasons. Forty-seven sitting inspectors general complained in 2014 that Obama officials were withholding documents (at the Justice Department, the Peace Corps and the Chemical Safety Board), thereby hindering oversight.

This sort of friction comes with serving as an IG. To be sure, Trump seems more discomfited than his predecessors by the system. But he should recognize, as his predecessors have, that presidents benefit from it. If a president wants to keep tabs on wrongdoing in departments or to judge the management skills of leaders, the IGs supply independent analysis. Moreover, they can serve a president’s political ends. The reports and comments of Michael Horowitz, the Justice Department’s inspector general, for example, lent credibility to the president’s claim that the FBI badly mishandled its investigation of connections between the Trump campaign and Russian officials, and that it may have violated the Foreign Intelligence Surveillance Act when it wiretapped campaign aide Carter Page. Horowitz’s conclusion that the FBI committed multiple errors carried far more weight than the president’s assertions.

Still, IGs should not have to stay in the good graces of a president to do their jobs. With some statuatory adjustments, Congress can better insulate them from pressure. For example, lawmakers might create a chief inspector general with authority to appoint and supervise all other IGs. Congress could establish that while the chief IG would be appointed by the president (with the Senate’s consent), and removable at will by the president, Trump and his successors could no longer fire the departmental and agency IGs. Only the chief IG could remove them. The Senate might insist that nominees for the new post pledge independence, in the same way judges promise to be independent of the president who appoints them.

The chief IG might seem to be beholden to the president. But Congress might be able to sustain and support his or her autonomy. It is generally easier to fire more obscure officials (like Linick) and harder to dismiss more prominent ones, especially when they are widely viewed as independent. Of course, Trump hasn’t hesitated to push out a host of senior officials, including Defense Secretary Jim Mattis and Secretary of State Rex Tillerson. But even he stayed his hand when it came to special counsel Robert S. Mueller III, whom he badly wanted to fire — a testament to Mueller’s reputation and his perceived independence, which a chief IG might share. In any case, future presidents will be less trigger-happy than Trump. A reform can be useful even if it does little to hinder the proclivities of a particular chief executive.

As an alternative, Congress might impose “for-cause” protections for the existing inspectors general — meaning they could lose their jobs for inefficiency, neglect or malfeasance in office, but not because of political disagreements. Under prevailing Supreme Court doctrine, Congress can grant for-cause protections to some executive officers. In Morrison v. Olson (1988), the court upheld similar protections for the independent counsel. (I don’t happen to agree with that case’s conclusion, but it’s good precedent that Congress could embrace.) If a president tried to frame a political disagreement as a for-cause firing, the ousted official could seek relief in court and perhaps be reinstated. Legislators can conclude, as the justices did for independent counsels, that a president’s need to control the IGs is not “so central to the functioning of the Executive Branch as to require” that they be removable at will.

I don’t wish to defend everything that IGs do. They can make mistakes and act in partisan or self-serving ways. Moreover, there is indisputably some degree of anti-Trump resistance within the executive branch. So perhaps it is understandable that the president is wary of Obama-era appointees. But in general, we ought to strengthen these crucial officials, who help the executive branch function properly and legally. Though Trump’s moves have weakened oversight, the overall system of IGs remains strong. With a few well-targeted tweaks from Congress, we can shore up a good system.