Fix for failing to count layers of Cura gcode (which uses G0 to move up, rather than G1) (ported to regression_fix)