It’s been six months since the Department of Defense had a permanent leader. After Secretary of Defense James Mattis resigned in protest in December, President Donald Trump named Patrick Shanahan, the department’s deputy secretary and a former Boeing executive, as its acting head. Then Shanahan stepped down on Tuesday after domestic-violence incidents in his family became public. Trump quickly named Mark Esper, the secretary of the army and a former Raytheon executive, to take command of the Pentagon.

This isn’t how things are supposed to work. The president’s nominees to lead federal agencies must be confirmed by the Senate before they can exercise the duties of the office. There’s an exception, however: The Federal Vacancies Reform Act of 1998 (FVRA) gives the president a certain amount of leeway to install other top federal officials into posts on a temporary basis.

In theory, presidents would use—and have used—the FVRA to fill gaps in leadership while the Senate considers a permanent replacement. Under Trump, however, the law has become a vehicle to place favored underlings in charge of major federal bureaucracies without the Republican Senate’s approval. In some cases, this takes place with the senators’ unspoken assent. In other cases, it happens in direct defiance of their wishes. Either way, it’s a legal flaw that must be corrected.

Perhaps the most glaring example of Trump circumventing the Senate’s constitutional duty came earlier this month. In May, White House officials confirmed that Trump intended to pick Ken Cuccinelli, the former Virginia attorney general, to lead U.S. Citizenship and Immigration Services (USCIS). But the prospect quickly faced strong opposition from Senate Republicans, many of whom Cuccinelli targeted from the right as president of the Senate Conservatives Fund. Facing near-certain defeat, Trump didn’t formally nominate Cuccinelli, naming him to the post in an acting capacity instead.

How did the president evade the Senate? According to Steve Vladeck, a University of Texas law professor, Trump first appointed Cuccinelli to USCIS as the agency’s “principal deputy director,” a post that apparently did not previously exist. Since federal law does not specify which official in the agency was the “first assistant,” Trump was then able to name Cuccinelli to the acting directorship. “In other words, through nothing other than internal administrative reshuffling,” Vladeck wrote, “the Trump administration was able to bootstrap Cuccinelli into the role of acting director, even though, until today, he had never held any position in the federal government.”