If the 14050 is base mounted often a good idea to avoid this behaviour is to canghe in configuration, topic motion, type robot, the parameter arm-angle reference direction from world y to axis 1. In this way there's no sign inversion of arm angle around when wrist is moving near shoulder around axis y.
Be careful that if you change this parameter you'll have to teach again your robtargets.
Good Luck