After nabbing seven Oscars for his Second World War epic The Bridge on the River Kwai in 1957, director David Lean was keen to embark on another large-scale movie. In 1960, he abandoned plans to direct a comprehensive biography of Mahatma Gandhi (a movie that would eventually be made by Richard Attenborough) and instead began work on an equally comprehensive biography of desert adventurer and archaeologist Colonel T.E. Lawrence.

The film, 1962’s Lawrence of Arabia, is now widely considered one of the greatest movies in cinema history. But its production was far from easy—not least because, by the time the cameras started rolling, Lean still did not have a complete script.

The movie’s first screenplay was written by the blacklisted Hollywood exile Michael Wilson, who had also contributed to the script for Bridge on the River Kwai. Lean, however, wasn’t keen on Wilson’s treatment of the story; he first handed control of the script over to the English playwright Beverley Cross and then to future Oscar-winner Robert Bolt. Bolt continued to tinker with the script, but with time ticking away, Lean was forced to begin shooting without a final draft.

Then, things went from bad to worse.

In 1962, Bolt was arrested in London during a protest for nuclear disarmament. Lean now not only had no script, but also – no scriptwriter. In desperation, producer Sam Spiegel was forced to fly from the set in Morocco back to London to bail Bolt out of prison and get him back to work. Reportedly, as part of the deal, Bolt was forced to sign an official “recognizance of good behavior”—essentially, a promise not to get into any more trouble! —to allow him to continue working.

Happily, it all came good in the end: Bolt’s script went on to earn him an Oscar nomination, and the movie itself went on to win seven of the ten Academy Awards for which it was nominated.