If you add a 0.3 second pause between the actions, then it should work reliably in most case I believe.
The issue appears to be that the system (sometimes?) animates the changes, and that making another request while the animation is in process results in the system getting confused.
I have reported this to Apple, and the next version of Keyboard Maestro will include the 0.3s delay, although that is exceptionally annoying since it means that the delay always happens even with the animations/issues only sometimes happen, but that is probably better in the name of reliability.