Castro turned out the way he did because the first thing he did, after deposing a dictator who was worse than he ever became, was to reach out to the US for help and we said no. So he turned to the USSR.
In Nicaragua, we were never remotely on the right side.
While the U.S. was wrong in its dealings with Cuba and while overthrowing Batista was a reasonable thing, Castro basically ruled in traditional Latin American caudillo fashion, to the detriment of his people. His one great accomplishment was increasing the literacy of the Cuban population, but in so many other areas his rule was harmful through his rigidity and traditional strongman tactics. He made lots of catastrophic mistakes for the Cuban economy by depending on Eastern European planners. Soviet aid to Cuba alone equalled almost the same amount as the entire U.S. foreign aid expenditure and as the Soviet economy faltered and they could no longer subsidize Fidel, his totally state-controlled economy was disastrous, but Fidel never gave up on it.
Interestingly, Latin American sources that I read back when I was a Latin American Studies major and got stuck with Cuba for my year long report, had a view of the Cuban Missile Crisis never mentioned by most U.S. authors, whether liberal or conservative. They felt that Castro had done a good deal to foment the crisis just for his own personal aggrandizement, to position himself in a place of power far out of line for the ruler of a tiny island nation.
Bernie was simply wrong–seeing Fidel through his old time Marxist lenses.
As for Nicaragua, I knew people in the Pentagon and in the Congress staff ranks who were trying to keep the Generals from saber rattling over invading Central American countries at the same time that Bernie was aggrandizing himself with his Central American trips. He was then, as now, simply a bullshitter par excellence.