Elon Musk will have to lay off the booze and pot if he wants to continue doing work for NASA, the agency’s chief warned this week, while laying into the SpaceX founder for his recent erratic behavior.

“I will tell you that was not helpful, and that did not inspire confidence, and the leaders of these organizations need to take that as an example of what to do when you lead an organization that’s going to launch American astronauts,” NASA Administrator Jim Bridenstein said Thursday during a meeting at NASA’s headquarters in Washington, DC, The Atlantic reported.

Bridenstein said he’s spoken with the South African-born Tesla founder, who promised he’d be changing his ways after being caught on video sipping a whiskey on the rocks and taking a hit from a joint on the “Joe Rogan Experience” podcast in September. The show is filmed in California, where marijuana is legal.

“We’ve had a number of conversations,” said Bridenstein. “I will tell you, he is as committed to safety as anybody, and he understands that that was not appropriate behavior, and you won’t be seeing that again.”

Bridenstein’s comments come in the wake of probes he ordered into workplace culture at SpaceX and Boeing, the two companies that have multimillion-dollar contracts with the space agency to fly its astronauts.

Bridenstein said his decision to launch the safety reviews was made in consideration of previous spacecraft tragedies, such as the Apollo 1 fire in 1967, which left three astronauts dead, and the Challenger and Columbia space shuttle disasters that killed 14.

“Every single one of those accidents had a number of complications. Of course, the technological piece was a big piece of it. [But] the other question that always comes up was, What was the culture of NASA?” he said.

“What was the culture of our contractors, and were there people that were raising a red flag that we didn’t listen to, and ultimately did that culture contributes to the failure and, in those cases, to disaster?”

The NASA boss said he wanted a review of Boeing and SpaceX even before Musk’s appearance on the podcast, calling the reviews a “necessary and appropriate step when you’re launching humans on rockets.”