M0 must be moved one line ahead

The M0 command appears to need to be placed one line ahead of where it would be expected. That is to stop on line 10 it must be placed on line 8. Am I missing something?