 							int motor_index, sensor_position;
 							int num_consumed;
 							int num_read = sscanf(tmp_str + i + 2, "%d%d%n", &motor_index, &sensor_position, &num_consumed);
-							if (num_read == 2) {
+							if (num_read != 2) {
+								sprintf(tmp_serial_out, "E#");
+								i += 2;
+								return;
+							}
 								steppers_controller.go_to_sensor_position(motor_index, &as5147s_controller,
 #ifdef USE_POTENTIOMETERS
 									&potentiometers_controller,

		int motor_index;
		byte num_sensors_attached;
		float motor_speed, motor_acceleration;
		sscanf(tmp_str + i + 2, "%d", &motor_index);
		steppers_controller.get_speed_and_acceleration(motor_index, &motor_speed, &motor_acceleration);
		num_sensors_attached = steppers_controller.get_num_attached_sensors(motor_index);
		sprintf(tmp_serial_out, "GS%d %d %d %d#", motor_index, (int)motor_speed, (int)motor_acceleration, num_sensors_attached);

		tera_ranger_one_lidar->run_motor(serial_out);
		if (serial_out[0]) {
			Serial.write(serial_out);
			Serial.flush();
			serial_out[0] = 0;
		}
	}
