How does my Dorico decide the stem direction in this case?

In this case, when I was copying Chopin’s Mazurka no.30, I noticed something odd.

The stem towards the sky even when there is a G way up there.
What is happening? It shouldn’t be right.

Then, when my friend moves the G in the higher octave up by one degree, the stem automatically faces the right direction.
When my friend moves the A up a degree, the stem faces the right direction too.

The reason Dorico chooses an up-stem for the beam consisting of A#4 and G4/G5 is as follows:

– The first note in the beam should take an up-stem
– The second dyad in the beam should take a down-stem
– Because the number of stems that should point in each direction is the same, it looks at the number of noteheads across the beam that are below the middle staff line versus those that are above the middle staff line; because there are two notes below the mid-line and one above, the end result is a beam with up-stems.

When it’s in this kind of even-stevens situation, Dorico doesn’t consider the greatest distance from the middle line, but rather the overall “weight” of the beam.