handle_serial_data bug fix