Investigators looking into similarities between the crash of a Boeing 737 MAX 8 in Ethiopia on March 11 and the crash of a similar plane in Indonesia on Oct. 29, 2018 have discovered the latter jetliner had almost crashed the day before it plunged into the Java Sea killing all on board.

The previous flight was only saved from destruction by an off-duty pilot who happened to be a passenger on the plane at the time. And the cause of this near fatal close call was similar to the one that eventually brought down Lion Air Flight 610 – a malfunctioning autopilot system.

Investigators said they weren’t alerted to this fact by Indonesian authorities but happened upon it during their investigation. The presence of a third pilot in the cockpit wasn’t revealed in a Nov. 28 report on the crash by Indonesia’s National Transportation Safety Committee or KNKT.

What investigators found was this off duty pilot was in the cockpit at the time of the near fatal incident. This “dead-head pilot” in aviation parlance was seated in the cockpit jumpseat. When the plane started pitching wildly, this pilot correctly diagnosed the problem.

He told the crew how to cope with the plane’s malfunctioning “Maneuvering Characteristics Augmentation System” or MCAS, according to people with knowledge of Indonesia’s investigation, said Bloomberg. The dead-head pilot told the crew to cut power to the motor, thereby driving the nose down, according to the people familiar. This drill is part of a checklist all pilots are required to memorize.

The very next day but under the command of a different crew facing an identical malfunction, the very same jetliner crashed into the Java Sea killing all 189 aboard. It is unclear if this doomed crew was informed about the close call of the day before.

Investigators said this previously undisclosed detail about the earlier Lion Air flight sheds more light on the mystery of how some 737 Max pilots facing a malfunctioning MCAS were able to avert disaster while others lost control of their planes and crashed.

Remains of Flight 610 Wreckage from Lion Air flight JT 610 lies at the Tanjung Priok port on October 29, 2018 in Jakarta, Indonesia. Photo: Ed Wray/Getty Images

“All the data and information that we have on the flight and the aircraft have been submitted to the Indonesian NTSC. We can’t provide additional comment at this stage due the ongoing investigation on the accident,” said Lion Air spokesman Danang Prihantoro.

The KNKT report said the plane have had multiple failures on previous flights and hadn’t been properly repaired.

Indonesian investigators believe a malfunctioning sensor tricked the Lion Air jetliner’s computers into thinking it needed to automatically bring the nose down to avoid a stall.