Hi, this could be a bunch of things.
First make sure there is no binding in your z axis travel.
Second slow down your accl and velocity and see if that helps.
Third your z could be just to heavy for the size stepper you are using.
Fourth just for fun try increasing you step and Dir pulse width to 5us and see if that makes any diff.
The dro does not know if the motor stalled so they will always read the correct location. This tells me that mach is doing it's thing and the problem is in the hardware..
Chad