A cloud of orange smoke rose over Cape Canaveral Air Force Station April 20, 2019, when the SpaceX Dragon 2 capsule exploded during an engine test. (Craig Bailey/AP)

An investigation into what caused the SpaceX capsule to blow up in April during an engine test has pinpointed a faulty valve that caused a propellant leak, a company official said Monday.

The valve is being replaced by a disc that would eliminate the possibility of such a leak, said Hans Koenigsmann, SpaceX’s vice president of build and flight reliability. But he called the finding “preliminary” said the investigation into the cause of the explosion that sent a plume of smoke wafting over the Florida space coast is continuing.

He did not rule out a flight with crew by the end of the year, a goal it had been pushing toward for months, but said that had now grown “increasingly difficult.”

“We want to make sure we find all the corrective actions,” he said.

SpaceX is designing the Dragon spacecraft to ferry NASA’s astronauts to and from the International Space Station. In March, it completed a successful test flight, sending the spacecraft, without anyone on board, to the station. It docked autonomously and then flew back to Earth again, safely landing in the Atlantic ocean. With that key milestone completed, the company seemed to be making progress toward a flight with astronauts by the end of the year.

But then in April it tested the engines that are designed to propel the spacecraft — and the astronauts in it — safely away from the rocket booster in the event of an emergency. The test did not go well. The spacecraft exploded after the leak into an internal pressure system, leaving NASA and SpaceX with another setback in a program that has seen several.

Last year, Boeing also had a propellant leak in the emergency abort system of its spacecraft. The company has said that it has since fixed the problem.

In 2014, NASA awarded contracts, worth nearly $7 billion combined to the two companies, but both have suffered a series of setbacks and delays. NASA is hoping they’ll be ready to fly soon since the agency has been forced to rely on Russia to fly its astronauts to space since the Space Shuttle was retired eight years ago.

The setbacks forced NASA recently to purchase two more seats on Russian spacecraft for about $170 million total. Those will ensure that the agency doesn’t have to face the embarrassing prospect of not having an American astronaut on board the station — the orbiting laboratory that has cost American taxpayers about $100 billion.

NASA hopes the abort system never has to be used. But the service it provides is vital and could save astronauts’ lives. The agency got a reminder of this late last year when a Russian spacecraft carrying an suffered a failure when its booster failed to separate properly. The spacecraft’s abort system kicked in, sending NASA Astronaut Nick Hague and his Russian counterpart Alexey Ovchinin on a wild ride to the edge of space, but they ended up landing safely.

In a call with reporters Monday, Koenigsmann and Kathy Lueders, the manager of the so-called commercial crew program for NASA, said the point of doing such tests on the ground is to make sure all of the systems are working properly before they start flying astronauts.

“What we have now is definitely the safer approach,” Koenigsmann said. “We didn’t really expect this to be a problem, but that’s what you learn when you test.”

Lueders said the explosion was “in a lot of ways a gift for us because it was a test on the ground.”

No one was injured during the explosion, officials said. SpaceX has been leading the investigation into it alongside NASA, the Federal Aviation Administration and the National Transportation Safety Board.

The valve is being replaced with a more robust disc that would require a high-pressure kick to blast it open, thus preventing any leaks, Koenigsmann said.

He said he was “optimistic” about the remedy and the ability to carry on, especially since the company had already been building the spacecraft for future missions. But he hedged when asked if the company would be able to fly this year.

“I don’t think it’s impossible,” he said, “but it’s getting increasingly difficult.” He added: “We’ll fly when we’re ready.