Final fixes for reading gcode in a separate thread