Compiling discrepancy between Windows XP and Linux

Hi everybody,
I have a very strange problem with a sketch which performs differently if compiled and uploaded to Arduino from Windows XP Home sp3 or Elementary OS Luna (a distro of Ubuntu Linux).

This sketch, between other things, reads a byte from a serial connection (bluetooth) and write it back to serial monitor.

This is what I get if I compile the sketch from WinXP: I sent over BT connection strings from "1" to "7" one time each. The ASCII code of these strings are reduced of 48 to transform string in byte. The result is correct, also functions in pointer array are correctly called. enter image description here

1
leftWindowDown
2
leftWindowUp
3
bootOpen
4
cabinLightOn
5
cabinLightOff
6
lockOn
7
lockOff

and here is what I get from Linux. I sent 4 times each string from "1" to "7" to see that result has nothing to do with what I need to get and also is not consistent with the same input data: for example when I send string "2" I get 104 106 106 104..... and same byte 106 is written with different Strings coming from BT. Also the functions are not called so it means that is not a Serial.print issue.

105
105
105
105
104
106
106
104
105
107
105
105
106
106
104
106
105
105
107
107
106
106
106
106
107
107
107
107

I'm sure it is a compiling issue because once the sketch is uploaded in Arduino it performs in the same way (correct or not) if I use serial monitor in WinXP or Linux.

Here's the sketch

#include "Arduino.h"
#include <SoftwareSerial.h>
#include <Streaming.h>
#define nrOfCommands 10

typedef void (* CmdFuncPtr) (); // this is a typedef to command functions

//the following declares an arry of 10 function pointers of type CmdFuncPtr
CmdFuncPtr setOfCmds[nrOfCommands] = {
  noOp,
  leftWindowDown,
  leftWindowUp,
  bootOpen,
  cabinLightOn,
  cabinLightOff,
  lockOn,
  lockOff,
  canStart,
  canStop
};


#define cmdLeftWindowDown 1
#define cmdLeftWindowUp 2
#define cmdBootOpen 3
#define cmdCabinLightOn 4
#define cmdCabinLightOff 5
#define cmdLockOn 6
#define cmdLockOff 7
#define cmdCanStart 8
#define cmdCanStop 9

#define buttonPin  4     // the number of the pushbutton pin
#define bluetoothTx 2
#define bluetoothRx 3

int buttonState = 0;         // variable for reading the pushbutton status
int androidSwitch=0;

byte incomingByte;  // incoming data
byte msg[12];
byte msgLen=0;
byte msgIdMsb=0;
byte msgIdLsb=0;

SoftwareSerial bluetooth(bluetoothTx,bluetoothRx);

void setup()
{
  //Setup usb serial connection to computer
  Serial.begin(115200);

  //Setup Bluetooth serial connection to android
  bluetooth.begin(115200);
  randomSeed(analogRead(10));
  delay(100);
}

void loop() {
  msgIdLsb=random(1,255);
  msgIdMsb=random(0,5);
  msg[0]=msgIdMsb;
  msg[1]=msgIdLsb;
  msgLen=random(9);
  msg[2]=msgLen;

  for (int x=3;x<msgLen+3;x++) {
    msg[x]=random(255);
  }

  for (int x=3+msgLen;x<11;x++) {
    msg[x]=0;
  }
  msg[11]='\n';
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
  if ((buttonState == HIGH)||(androidSwitch==HIGH)) {  
    for (int x=0;x<12;x++) {
      Serial<<msg[x]<<" ";
      bluetooth.write(uint8_t(msg[x]));
    }
    Serial<<endl;
  }

  //Read from bluetooth and write to usb serial
  if(bluetooth.available())
  {
    incomingByte = bluetooth.read()-48;
    Serial<<incomingByte<<endl;
    if (incomingByte<nrOfCommands)
      setOfCmds[incomingByte]();

  }

  delay(10);
}

void noOp(void)
{
  Serial<<"noOp"<<endl;
};

void leftWindowDown(void)
{
  Serial<<"leftWindowDown"<<endl;
};

void leftWindowUp(void)
{
  Serial<<"leftWindowUp"<<endl;
};

void bootOpen(void)
{
  Serial<<"bootOpen"<<endl;
};

void cabinLightOn(void)
{
  Serial<<"cabinLightOn"<<endl;
};

void cabinLightOff(void)
{
  Serial<<"cabinLightOff"<<endl;
};

void lockOn(void) 
{
  Serial<<"lockOn"<<endl;
};

void lockOff(void)
{
  Serial<<"lockOff"<<endl;
};

void canStart(void)
{
  androidSwitch=HIGH;
};

void canStop(void)
{
  androidSwitch=LOW;
};

Any help would be very helpful.
Thanks in advance.