How I Met Your Mother made its fair share of mistakes over its nine seasons, but the sitcom’s worst misstep was casting Kyle MacLachlan as the cheated-on season 6 character the Captain. Over its 9 seasons on the air, How I Met Your Mother fell in and out of favor with critics due to inconsistent writing and some messy characterization.

To stand out from its inspiration Friends, the hang-out sitcom used its titular framing device to retell the love life of protagonist Ted to his grown-up kids via narration (with frequent B-story diversions starring his friends Robin, Marshall, Lily, and Barney). Some seasons fared better than other with critics, with season 6 of How I Met Your Mother being particularly infamous among fans thanks to its never-ending Zoey subplot. However, despite fans disliking Zoey herself (and Ted, to an extent), it’s the casting of Zoey’s husband, the Captain, that sinks this potentially promising story.

Related: How I Met Your Mother’s Original Plan When Casting Barney Stinson

Once Upon A Time star Jennifer Morrison is fine in the thankless role of Zoey, an activist who cheats on her wealthy husband with Ted. But it’s a part that pretty much no actor could make charming, which is likely why Zoey barely appeared on How I Met Your Mother after the pair’s affair ended. How I Met Your Mother’s choice to cast Dale Cooper himself Kyle MacLachlan as Zoey’s cuckolded husband the Captain, however, was a bit of stunt casting that went disastrously wrong for the series, as it made the character too likable and Zoey and Ted ended up the bad guys of the season.

Twin Peaks star and cult character actor MacLachlan is as charming as ever in the role, playing the character with bombastic zeal. But that charm is precisely the problem for How I Met Your Mother, as the Captain ends up being likable and funny enough for fans to have trouble seeing why Zoey would rather be with Ted (not to mention why the Captain would end up with someone as unlikeable as her in the first place). The supporting cast of How I Met Your Mother don’t help here as not only do the rest of the characters like the Captain, but he’s instrumental in improving Lily’s career and reappears throughout the rest of the show, always proving a funny and fun presence through to the divisive finale.

As such, despite Ted being the main character of the series, it’s hard to root for him throughout the much-maligned Zoey plot. The Captain is too fun (and funny) for Zoey’s supposedly loveless marriage to be completely passionless, and it seems unlikely that lovelorn sad sack Ted would woo her away from this charming Gatsby-esque figure. As Katie Holmes’ turn as the Slutty Pumpkin in the show’s last Halloween outing proves, How I Met Your Mother never had trouble attracting guest stars, less likable actor might have made the role (and thus, the subplot) work, as a more stoic and boring Captain would have made Zoey’s dissatisfaction and subsequent affair more believable. But it’s pretty telling that How I Met Your Mother held onto MacLachlan for later episodes while dropping Zoey, the character who he was ostensibly only there to introduce, as the Captain ended up being not only more interesting than his ex-wife but also more engaging than Ted himself.

More: How I Met Your Mother’s Alternate Ending Explained