HOUSTON (AP) — A federal judge in Texas has threatened to hold Homeland Security Secretary Jeh Johnson and other top immigration enforcement officials in contempt of court for not fixing problems that led to work permits being mistakenly awarded under President Barack Obama’s executive immigration action after the judge had put the plan on hold.

The Justice Department had said about 2,000 individuals had been sent three-year work authorizations after U.S. District Judge Andrew Hanen in Brownsville, Texas, temporarily blocked the immigration action on Feb. 16.

In a court order Tuesday, Hanen said government officials have yet to fix the problem. The judge also requested Johnson and four other officials attend an Aug. 19 hearing to explain why the issue hasn’t been fixed and to “be prepared to show why he or she should not be held in contempt of court.”

“This court has expressed its willingness to believe that these actions were accidental and not done purposefully to violate this court’s order. Nevertheless, it is shocked and surprised at the cavalier attitude the government has taken with regard to its ‘efforts’ to rectify this situation,” Hanen wrote.

The other officials are: R. Gil Kerlikowske, commissioner of U.S. Customs and Border Protection; Ronald Vitiello, deputy chief of the U.S. Border Patrol; Sarah Saldaña, director of U.S. Immigration and Customs Enforcement; and Leon Rodriguez, director of U.S. Citizenship and Immigration Services.

In court documents filed in May, Rodríguez had said his agency had implemented “immediate corrective measures,” including revoking the permits and modifying computer systems to prevent issuing such permits in the future.

Hanen said in his order that if the federal government fixes the problem by July 31, he will cancel the Aug. 19 hearing.

Obama proposed in November expanding a program that protects young immigrants from deportation if they were brought to the U.S. illegally as children and adding another that extends deportation protections to parents of U.S. citizens and permanent residents who have been in the country for some years.

He said lack of action by Congress forced him to make sweeping changes to immigration rules on his own, but Republicans said Obama overstepped his authority.

The judge had issued the injunction at the request of a coalition of 26 states, led by Texas, which have filed a lawsuit to stop Obama’s action, saying it is unconstitutional. An appeal of Hanen’s ruling is set to be argued Friday before the 5th U.S. Circuit Court of Appeals in New Orleans.

Hanen has previously criticized the federal government’s actions in the lawsuit, saying the government had been “misleading” after officials revealed that more than 108,000 people had already received three-year reprieves from deportation as well as work permits when the judge had believed that no action would be taken before he issued a ruling on the injunction.

Justice Department attorneys apologized for any confusion regarding the 108,000 reprieves but insisted they were granted under a 2012 program that wasn’t affected by the injunction.