Looking at your script, there is no Z co-ordinate move before the first G2 move, so I do not see how the machine can compute the move (I couldn't do it on paper since I didn't know where to start). I do not know where it gets it from ( other than one might presume it gets it from the DRO's ). This you would think would be fine, but it may be for moves like this it takes it from some other register which is updated on every X or Z move.
Try on the line above, putting in a Z position on the G0 move and see if this solves the problem.