BASE(z_axis)
MOVEABS(0)
WA(200)
REPEAT
WA(10)
UNTIL REMAIN < 5
Probably, the MOVEABS is loading into PMOVE or even to NTYPE but the check of REMAIN is still seeing the REMAIN from the previous move that is in MTYPE. You must check that the move you load is actually in the MTYPE before checking REMAIN.