local-pref and weight not working fine?

Hi,
I have a problem with my router RouterOS 7.18, the non-optimal path is still active even when I force the primary with local-pref and weight, and the secondary has a larger AS-PATH

The primary path is the one via 10.9.96.2, but it still considers the secondary as active, and I don’t want to do that.

What could be wrong?

The only “solution” I have found is to use the following rule in the IN chain of the BGP session to force one BGP session, but it’s not the ideal way to do that.

“set distance 17;”

For best path selection to work routes must be received from peers belonging to the same instance:
https://help.mikrotik.com/docs/spaces/ROS/pages/328220/BGP#BGP-Best-PathSelection