how to reverse stepping motor direction
How do you stop the motor? You should stop the clock and hold enable for some time. Generally, depending on the load, when releasing enable, the motor may move to a slightly different position. In some applications, it may be necessary to keep it powered, possibly at a lower current.
Irregular movement also happens when operating the motor above start/stopp frequency without a speed ramp. But I assume that you are still far below, as long as your application doesn't involve a high inertia moment.