A film set is a beautiful thing. A perfect combination of art and industry buzzing with activity and energy. It’s a machine. A vast enterprise of interlocking mechanisms working in concert to achieve a common goal. The result can be simply magical. Stories that dazzle, delight, and destroy whether they’re being watched on a 70-foot screen or an iPhone. But a film set is a delicate mechanism. One grain of sand in the machinery can cripple the entire operation. It can turn into chaos.

The movies in this list had buckets of sand in their machinery during production. Everything from unfinished scripts to drug-related hospitalizations conspired to thrust these sets into chaos, threatening the filmmakers’s ability to even finish the project let alone produce something of artistic and commercial merit. Yet despite these tumultuous environments, each of the films on this list turned into gold due to the creativity, ingenuity, and dogged persistence of their crews. Here are the best movies that survived chaotic productions.

10 Anchorman: The Legend of Ron Burgundy

The Anchorman cast in suits get ready to fight (2004)
Apatow Productions

Anchorman: The Legend of Ron Burgundy cemented Will Ferrell as a comedy superstar and proved Adam McKay’s credentials as a bankable director. Yet the original conception of Ron Burgundy’s saga (preserved in the companion film Wake Up, Ron Burgundy: The Lost Movie) would have certainly endangered that outcome.

The original storyline, which made it all the way to testing, features Burgundy and friends investigating a terrorist group named “The Alarm Clock.” It contains elements of the satire found in McKay’s later work, but the film is uneven and struggles to achieve a consistent tone. Test audiences felt similarly. The results were so poor that the filmmakers were forced to rewrite and re-shoot the majority of the film, creating the version released in theaters. McKay’s ability to keep the cast and crew positive and engaged during this dark time shows excellent leadership and why he has had such a successful career.

Related: Best Will Ferrell Movies, Ranked

9 Cleopatra

Cleopatra 1963 Movie of Ancient Egypt
20th Century Studios

Two Hollywood legends playing two of the most famous lovers in history? Sounds like a safe bet for box office success. But for Cleopatra, starring Elizabeth Taylor and Richard Burton, just getting to theaters was an ordeal. First, Taylor contracted meningitis which required her to be hospitalized and miss multiple weeks of shooting. Consequently, director Rouben Mamoulian had only 10 minutes of film after 16 weeks, at a cost of $7 million. Mamoulian resigned soon after. But this wasn’t the end of the production’s problems. Taylor became ill again, this time a case of pneumonia which required a tracheotomy. New director Joseph L. Mankiewicz turned to amphetamines to keep up with the workload while Taylor’s and Burton’s love affair brought more bad press to an already infamous production.

Fox even attempted to halt production and fire producer Walter Wagner until protests from Mankiewicz, Taylor, and Burton forced the studio to back down. Yet despite the turbulent production, the electric chemistry between Taylor and Burton combined with Mankiewicz’s vision made the movie a hit. Cleopatra became the highest-grossing film of 1963 and was nominated for nine Oscars.

8 Titanic

Titanic
Paramount Pictures

James Cameron once likened filmmaking to war. Well, the director had quite the battle on his hands making his 1997 epic Titanic. Several cast members got sick from spending so much time in cold water tanks, including star Kate Winslet. Three stuntmen were injured and Cameron’s demanding style dampened crew morale. But the most harrowing moment came while shooting in Canada when a still unidentified individual slipped PCP into the chowder one night at dinner. Cameron and dozens of other crew members became ill, with 50 being taken to the hospital, including actor Bill Paxton.

The shoot ran over time and over budget, leading to Fox reaching a compromise with Paramount to co-finance the film. It turned out be one of the best decisions in Paramount history as Titanic became the highest-grossing film in history at the time, won 11 Oscars, and turned Winslet and Leonardo DiCaprio into international superstars.

7 Ratatouille

ratatouille
Pixar

Kitchens can be chaotic places. But Pixar almost certainly didn’t set out to replicate that chaos when making 2007’s smash hit Ratatouille. The project kicked off in 2000 with a story from animator Jan Pinkava but after four years of development, the studio turned to Bob Peterson. Just a year later, Pixar was still unhappy with the story and tapped Brad Bird to helm the film. The Incredibles director had a tall task in front of him: take a floundering animation production from script to screen in only 18 months. But Bird told Entertainment Weekly that the condensed schedule actually helped the production, “I just had to make decisions and stick with them. All the time for rumination had been used up.” His decisiveness certainly paid off, with Ratatouille taking home the Oscar for Best Animated Feature and grossing over $600 million worldwide.

6 The Wizard of Oz

Protagonist of the movie The Wizard of Oz
    Loew's, Inc.

The production of The Wizard of Oz wasn’t nearly as enchanting as the eponymous fantasy world where much of the film takes place. The studio went through two directors before settling on Victor Fleming, causing delays and reshoots. Buddy Ebsen, the original Tin Man, had to drop out after being hospitalized due to an allergic reaction to the aluminum makeup used for the role. Conditions on set were horrid. The lights needed to film in Technicolor sent on-set temperatures soaring over 100℉. The lack of safety standards led to Margaret Hamilton, the Wicked Witch of the West, enduring third degree burns after a mistimed explosion set fire to her toxic copper makeup. Furthermore, Judy Garland reportedly suffered from widespread physical and emotional abuse on set in addition to a drug-heavy diet designed to control her weight. That such a joyous, family friendly film managed to rise from this cauldron of chaos is truly astonishing.

5 Gladiator

Russell Crowe as Maximus Decimus Meridius in the battleground
DreamWorks Distribution LLC (North America) & United International Pictures (International)

Gladiator is a brutal sword-and-sandal epic helmed by Ridley Scott and starring Russell Crowe in a powerhouse performance as a disgraced Roman general on a quest to avenge the murder of his wife and son. However, it wasn’t the extensive sets or special effects that made the shoot difficult (although Crowe did barely avoid being mauled by a tiger). The main problem was with the script. First, principal photography began with only about a quarter of the script finished, leading to uncertainty and forced improvisation. Two, the pages that were written often fell short of the cast’s expectations. Crowe, in particular, had issues with the dialogue and repeatedly insisted on rewrites. Yet Crowe and Scott had a clear vision of the character’s emotional journey and Scott’s powers as a visual artist imbued the film with a cinematic depth that transcended the tumultuous production. The end result? A classic epic which made over $500 million and won Academy Awards for Best Picture and Best Actor.

4 Apocalypse Now

Martin Sheen in Apocalypse Now
United Artists

Apocalypse Now definitely wins the award for the most chaotic production on this list. Francis Ford Coppola’s Vietnam War masterpiece explores themes of existentialism, madness, and the brutality of human beings. Ironically, these themes were also present in the production of the film.

The trouble started before the cameras even got rolling. A severe typhoon destroyed over half of the sets in the Philippines, resulting in production delays and heavy financial losses. The situation got worse when Martin Sheen suffered a heart attack on set, necessitating his brother Joe to step in until he recovered. Coppola had further headaches when Marlon Brando showed up for work extremely overweight, forcing the director to change his shot list. Coppola, however, carried on, showing the same persistence and dogged commitment to his vision as he did with The Godfather to make what is regarded as one of the best films ever produced.

Related: Apocalypse Now: Why Francis Ford Coppola Deserves More Credit for the Masterpiece

3 Jaws

A scene from Jaws
Universal Pictures

When a 26-year-old Steven Spielberg arrived in Martha’s Vineyard to direct Jaws, he hardly could have imagined the experience would make him say, “I thought my career as a filmmaker was over.” The main problem was that Jaws was shot on the ocean, the first major film to do so. This led to a long list of problems including soaked cameras, seasick actors, and unwanted vessels drifting into frame. Worst of all, the three mechanical prop sharks built for the production rarely worked. Yet Spielberg found magic in the obstacles. Unable to rely on the prop sharks, he used more subtle methods to imply the beast’s ferocity. This ratcheted up the suspense and allowed audience's imaginations to run wild, heightening the horror of the Great White. Far from ending Spielberg’s career, Jaws catapulted the young director into the stratosphere and helped launch one of the greatest careers in Hollywood history.

2 Casablanca

Casablanca 1942 - Rick and Ilsa looking into each other's eyes
Warner Bros.

The iconic romance Casablanca seemed like it had a solid foundation in the beginning. Warner Bros. had newly minted star Humphrey Bogart and the up-and-coming Ingrid Bergman in the lead roles and experienced director Michael Curtiz at the helm. Yet the production was missing a vital piece of the filmmaking process - the script. By the time principal production began they only had half of the screenplay written, necessitating the film being shot in chronological order. It even got to the point where co-writer Robert Koch delivered scenes to Curtiz on the day they were going to be shot.

This stressful environment inevitably led to clashes between writer and director, with both wanting to prioritize different aspects of the story. But as Koch said later, “perhaps it was this tug-of-war between Curtiz and me that gave the film a certain balance.” Regardless of when the pages were finished, they contained the words and actions that fueled Bogart’s and Bergman’s legendary performances, leading to one of the most influential movies in history.

1 The Godfather

Marlon Brando in The Godfather
Paramount Pictures

While the Corleone family may be methodical and organized, the production of The Godfather was anything but. Widely considered to be the best film ever made, the adaptation of Mario Puzo’s novel got off to a rocky start. Director Francis Ford Coppola (making his second appearance on this list) only took the job in an effort to save his production company, American Zoetrope, which was over $400,000 in debt. He clashed with Paramount over the budget, locations, and casting, working under the constant threat of being replaced. He even had to preemptively fire his editor and assistant director to prevent a mutiny. The real-life mafia also threatened the film, shooting up producer Albert S. Ruddy’s car in an effort to quash the production. But Coppola soldiered on, sticking to his vision and letting his brilliant filmmaking do the talking. The result? An Oscar-winning cinematic masterpiece that saved Paramount, revitalized Brando, and introduced the world to Al Pacino. All the stress and chaos was surely worth it.