You forgot to add that on appeal, review of a trial judge's rulings are on an 'abuse of discretion' basis, whatever that means. Only the most blantant favoritism by a trial court judge will be reversed by an appellate court, which happens only when the appeals court would be too embarassed to not reverse the trial court judge's rulings. You are right, this happens far to often. It's even worse when an innocent accused is stuck with a public defendaer who is more interested in getting along with the prosecutor than defending his client.
Paid defense attorneys are no better, unfortuneately. They have to worry about being "too agressive" in defending their clients, or the judge will just start screwing all of their clients, and their careers will be ruined.