Is it stopping at Zaxis 1st Ref. or 2nd Ref.?
If 2nd Ref., then some machines have a Limit Switch to interlock the Z-axis 2nd Ref. position, so this limit switch may not be working.
Some machines also have a Position Switch (s/w CAM) as interlock for this position, if 2nd ref par. value is changed, it is also required to change in this PSW.