Unexplained stacking behaviour

I created the stack on the left. Please note the order of the notes. I selected all notes with a marquee → ⌘’ → the notes are stacked but not in the correct order.

thanks in advance for your time and help

Please refer to this recent thread on stacking order, which includes documentation reference on how to select the primary note to stack under, and goes on to point out some snarls to pay attention to, as well as some edge cases that might be bugs.