What’s not to love about the magical glow of television? Every week (or all at once on Netflix) each of our favorite shows are presented like an intimate little movie but in the privacy of our homes. We just can’t get enough of our favorite characters living out their wacky adventures — if it’s a comedy — or enduring their sad and troubled lives — if it’s a drama.

But sometimes the real drama is behind the screen. Off-stage shenanigans can rock an actor’s personal and professional life and those of the cast and crew of the TV show where they work. Sometimes stars can’t or won’t work on a show unless big changes occur, and at other times, real life interjects itself into a fictional world. Here are some times when TV writers had to throw the script out the window to accommodate behind-the-scenes drama or unexpected tragedy.

The big break theory

Those endless reruns of The Big Bang Theory have forever etched certain elements of the show into the collective consciousness. For example, while most folks know Penny (Kaley Cuoco) eventually ditches her unsuccessful acting career and unfulfilling waitressing job at the Cheesecake Factory to become a drug sales rep, you may not remember that those aren’t the only jobs she’s tried.

While the show’s fourth season was in production in 2010, Cuoco took a horse-riding lesson that didn’t go as planned. Her horse reportedly threw her off, then landed on her leg. Cuoco recalled that moment on The Ellen DeGeneres Show (via Entertainment Weekly), explaining that her foot was facing the wrong way and "all the bones were sticking out." Doctors weighed partial amputation but were ultimately able to save the limb.

Unable to walk, Big Bang writers cut Penny out of two episodes, then devised a plot where she trains to be a bartender at the Cheesecake Factory. She practices making drinks for all the nerds while concealing her leg, which had been outfitted with huge metal rods, behind furniture topped with bottles of booze.

Goodbye, Susan

On a show that was incredibly popular, despite being populated almost entirely by wholly unlikable characters (there was a guy named the "Soup Nazi," for the love of Festivus), perhaps the worst of all was George Costanza (Jason Alexander). George was a selfish, whiny jerk, but there’s apparently someone for everyone because in 1995, he got engaged to his bland girlfriend, Susan Ross (Heidi Swedberg).

But this love story didn’t go as planned. In 2015, Alexander revealed on The Howard Stern Show that he struggled with Swedberg. "I couldn’t figure out how to play off of her," he said (via The Hollywood Reporter). "Her instincts for doing a scene, where the comedy was, and mine were always misfiring."

As co-stars Jerry Seinfeld and Julia Louis-Dreyfus shared more and more scenes with Swedberg, they began to relate to Alexander’s frustration. At one point, Julia Louis-Dreyfus offhandedly quipped, "Don’t you just want to kill her?" — meaning Susan. That gave co-creator and writer Larry David an idea. Susan’s cause of death: ingesting poisonous glue while licking the cheap wedding invitation envelopes Costanza buys.

The what and why of Who

With the exception of a 16-year gap from 1989 to 2005, Doctor Who has been running since 1963. While most long-running TV shows involve a lot of cast replacements, Doctor Who has kept the same main character at its forefront for more than 50 years. How?

Well, "The Doctor" is a 900-year-old alien "Time Lord" who uses a time-traveling police box called the TARDIS to traverse space and time with relative ease. Once in a while, all that travel catches up with the doctor, and he must shed his human form and take on a new one. In the world of the show, that’s called "regeneration," and it’s always an emotional moment when the doctor changes, say, from David Tennant into Matt Smith or from Peter Capaldi into Jodie Whittaker. Regeneration is a major part of the elaborate Who mythos, but it came about as a clever solution to a big problem.

In 1966, the first doctor, 58-year-old William Hartnell, had to leave the show because of health problems. Producers didn’t want to end the series, but they didn’t know how to replace the star. Then they realized that the main character was an alien, so anything was possible. Result: Hartnell’s doctor regenerated into actor Patrick Troughton’s doctor.

All in the family, and then some

Perhaps no one has dominated a show quite like Carroll O’Connor dominated the ’70s hit sitcom All in the Family. He portrays obnoxious bigot Archie Bunker, who browbeats and insults the handful of people left in the world who love him. It’s hard to imagine All in the Family losing Archie Bunker, but it almost happened.

According to an AV Club interview with actor James Cromwell, O’Connor quit the show in Season 5 as a contract renegotiation tactic, thinking he had producers over a barrel. "He wanted more money, and he wanted his name above the title," Cromwell said.

In response, show creator Norman Lear came up with a plan to kill off Archie and retool the show into a series called Stretch Cunningham, in which Cromwell would portray Archie’s buddy (whose name was Stretch Cunningham). "Archie and Stretch went to Buffalo for a conference, and I lost him in Buffalo, and I came back and I said, ‘I don’t know where he is.’" Cromwell recalled. Two Archie-free episodes of All in the Family were shot under that premise, with a third written where Archie’s murdered body is found. Cromwell said he was rehearsing that pivotal episode when O’Connor settled his dispute and agreed to return to work.

Parks and separation

Parks and Recreation evolved significantly following its debut in 2009. In the beginning, Leslie Knope (Amy Poehler) is kind of incompetent instead of low-key heroic, and she still harbors feelings for her ex, a city planner named Mark Brendanawicz (Paul Schneider). As the series progressed, there was far less action for Mark. "I signed up for a specific character that was changed in mid-season," Schneider told ScreenCrush. "And, all of a sudden, I was kind of confused and kind of having a lot less to do." Schneider asked to leave Parks to return to his true love: moody indie films such as All the Real Girls and Lars and the Real Girl.

His exit forced writers to re-think their long-term plans for Mark. Parks co-creator and showrunner Mike Schur told the Los Angeles Times that Mark’s character was based on a real-life city planner who "oscillated back and forth" between government work and the private sector, growing equally frustrated with both. Schur intended for Mark to follow a similar trajectory, but that never happened because Schneider never came back.

Dreaming in Dallas

Dallas was always an ensemble show, but come on, millions tuned in just to ogle glamorous ’80s lady Victoria Principal as Pam Ewing and swoon over hunky Patrick Duffy as Bobby Ewing — the only decent human being in the soap’s fictional world. In 1985, Dallas was the No. 2 show on television when Duffy decided to ditch.

"I left because I had done the show for seven years. My contract was for seven years," he told The Huffington Post. "I thought if it was ever a time at the height of the popularity of that show, that I might be able to launch into something that was more of a single, starring venue, that that would be the time to do it."

That successful solo vehicle never materialized, so when Dallas producers asked Duffy to return, he did. One little problem: In 1985, Bobby died after heroically saving another person’s life, so writing him back into the show would be tricky. Dallas resorted to one of the most ridiculous plot twists in soap history. In the season finale of the show’s ninth season in May 1986, Bobby’s widow wakes up to the sound of running water in the bathroom. She finds Bobby taking a shower. The entire Bobby-free season was all just a dream.

Married…with Children planned for more children

There’s a long, bizarre history of TV shows addressing real-life pregnancies. Sometimes, they’re written into the show directly, and other times, writers gets creative about how to mask a growing baby bump. Maybe the actress stands behind furniture or carries a laundry basket. On Friends, Phoebe Buffay became a surrogate for her brother’s triplets when actress Lisa Kudrow was expecting. New Girl sent Jess Day into sequestered jury duty when preggers Zooey Deschanel started to show. But what happens when a show writes a star’s pregnancy into the show, and then the actress tragically suffers a miscarriage?

The often tacky and tasteless Married…with Children faced that sad situation and handled it rather tactfully in 1992. When actress Katey Sagal was expecting, so too was Peg Bundy, which made for some comical storylines about Al Bundy (Ed O’Neill) feeling even more tied down to the wife and family he so obviously loathed. Then Sagal lost the baby, which prompted Married writers to explain that the whole pregnancy had been one of Al’s crazy dreams.

Death comes to Sesame Street

There’s no more dramatic, course-changing form of off-screen drama than an actor’s death, and the passing of Will Lee was devastating for the cast and crew of Sesame Street. The actor had portrayed Mr. Hooper, the kindly, bow-tied proprietor of Hooper’s Store since the show’s debut on public television in 1969. The master bird seed milkshake mixologist died of a heart attack in 1982 at age 74.

How would Sesame Street, a show for children, handle the sudden loss of Mr. Hooper? Rather than say he went on vacation or just say nothing and install a new shopkeeper, Sesame Street decided to be respectful to both Lee and its young audience by addressing the death — and death itself — head-on. Mr. Hooper’s passing became a teachable moment in an episode titled "Farewell, Mr. Hooper." Airing on Thanksgiving Day in 1983, the episode depicts Mr. Hooper as having died a while back, and Big Bird (as an audience surrogate) wondering when he’s coming back. The cast of humans gently explains to Big Bird and to kids at home that death is final, but that it’s okay to feel sad and it’s important to always remember our deceased loved ones. (No, you’re crying.)

Doyle’s toil spoiled

The era of "peak TV" arguably began with cable shows such as Breaking Bad and Mad Men in the late 2000s, but Joss Whedon laid the groundwork with genre-bending, impeccably written shows such as Buffy the Vampire Slayer, Firefly, and Angel. The "Whedonverse" also pioneered a signature move of today’s prestige dramas: unexpectedly killing off a main character.

On Angel, Irish seer Doyle (Glenn Quinn) dies after just nine first-season episodes. According to Angel DVD commentaries, Whedon planned to ax a character early in the show’s run to shock the audience, but he initially wasn’t sure who to off. Quinn reportedly became difficult to work with, so Whedon’s decision became clear. He initially planned to bring Doyle (and Quinn) back later (because in these supernatural shows death is never final,) but those plans were scrapped after Quinn died of a drug overdose in 2002.

Lynn Redgrave wanted to make work calls

The 1979 to 1982 CBS sitcom House Calls was a Nielsen top-30 ranked show starring Lynn Redgrave as a hospital administrator and Wayne Rogers as a cool doctor she desperately doesn’t want to fall in love with but does anyway. The romantic entanglements between their respective characters, Ann Atkinson and Dr. Charley Michaels, are destroyed near the beginning of the show’s third season in 1981, when Ann abruptly disappears. Charley receives a letter, which he reads aloud, explaining that she’s returned to her native England. The rest of the show focused on the complicated relationship between Charley and newcomer Jane Jeffries (Sharon Gless).

Let’s read between the lines of that letter: Universal Television supposedly relieved Redgrave of her contract at her behest, after the entertainment conglomerate wouldn’t finance her fledgling production company, but the actress tells a different story. Redgrave had just given birth and wanted to bring her baby girl to work. "It would break my heart to leave her," Redgrave told People. "I don’t believe it would be good for her." Redgrave also wanted to breastfeed in her dressing room between scenes. Producers allegedly wouldn’t let her, so she asked to be written off the show.