After months of worry that they might blow some big chances in California due to the state’s unusual primary system — and millions of dollars spent to try to avoid that nightmare scenario — House Democrats appear to have dodged a bullet with most primary votes counted.

Party strategists have been concerned about getting locked out in five different districts they hope to flip, where two Republicans could emerge in first and second place and get to face one another in the state’s all-party “jungle” primary. Based on election results as of Wednesday morning it appears likely, though not certain, that Democrats have avoided that disaster in all five districts.

Democrats’ biggest worry for months has been the race against Rep. Dana Rohrabacher (R-CA), whose Russia-hugging and other unusual views have hurt him with GOP loyalists and gave another Republican an opportunity in the race. Their fears were well-founded, but based on results it appears Democrats will get a candidate through in that race.

With all precincts reporting, businessman Harley Rouda, national Democrats’ preferred candidate, clung to second place behind Rohrabacher with 17.3 percent of the vote, with scientist Hans Keirstead (D) behind him by just 73 votes (17.2 percent) and former Rohrabacher protege Scott Baugh nipping at their heels with 16.1 percent of the vote. A trio of Democrats who dropped out of the race when Baugh jumped in were pulling more than 5 percent of the vote, risking playing accidental spoilers in spite of their decisions to drop out for the good of the party.

Democrats are now optimistic about their chances of taking out Rohrabacher with Rouda, a candidate strategists would much rather see given questions about Keirstead’s baggage.

California is notoriously slow at counting votes, and this year is even slower, because for the first time any ballots postmarked by Election Day will be accepted. Los Angeles County also had a major snafu that left more than 118,000 registered voters off voting rosters, meaning there will be many more provisional ballots (a sliver of retiring Rep. Ed Royce’s district is in L.A. County). It could be days before final results are known in all of these key races, as many ballots remain uncounted — but if a Democrat can hold on in Rohrabacher’s district they’ll avoid the shutout scenario party leaders have been so fearful of.

Democrats also look like they won’t get shut out in the race against Rep. Duncan Hunter (R-CA), whose ethics issues have made him potentially vulnerable. A Democrat and a Republican were in a close race with 95 percent of precincts reporting, but the Democrat had 16 percent of the vote to the Republican’s 13 percent.

Even better news for Democrats: They appear almost certain to get a candidate through in the Democratic-leaning seat held by retiring Rep. Darrell Issa (R-CA). While Republican Diane Harkey held a lead with 25 percent of the total vote, she was trailed by a trio of Democrats who had support in the teens — Mike Levin, Sara Jacobs and Doug Applegate — before the next-closest Republican, who was in the high single digits. With 99 percent of precincts reporting, Levin held 17 percent of the vote.

And Republican Young Kim and Democrat Gil Cisneros, their parties’ respected favorites, were in first and second in the race to succeed Royce in another hotly contested race. Kim had 22 percent to 19 percent for Cisneros, 14 percent for Republican Phil Liberatore and 9 percent for Democrat Andy Thorburn, giving Democrats the matchup they were hoping for.

It also appears they’ll also get a Democrat through against Rep. Jeff Denham (R-CA), with Democrat Josh Harder edging out a Republican sitting in third place.

National Democrats also picked their candidates in three districts Hillary Clinton won two years ago. Non-profit executive Katie Hill led her race to face Rep. Steve Knight (R-CA), while law professor Katie Porter (D) held a slim lead in her primary to face Rep. Mimi Walters (R-CA). Democrat TJ Cox was uncontested in his bid to face Rep. David Valadao (R-CA) in the fall.

In statewide contests, California Lt. Gov. Gavin Newsom (D) and businessman John Cox (R) advanced to the general election for governor, all but guaranteeing Newsom will be California’s next governor in the heavily Democratic state. Cox easily bested former Los Angeles Mayor Antonio Villaraigosa (D) in the race, while Newsom cruised, as expected.

And Sen. Diane Feinstein (D-CA) will face progressive challenger Kevin De Leon (D) in the general election, though her substantial lead in the first round of voting indicates the race won’t be competitive.

This post was last updated at 11:30 a.m. EST.