Serial nested if statements (Not working)
Without seeing your code I'm taking a guess, but I suspect that you are entering into the code to parse before you have a full serial command available. So sometimes there's only 1 byte available and sometimes all 3 are there, hence the unpredictable behavior.

I would change the first test to the following:

if (Serial.available() &gt;= 3)


Which will wait until you have an entire command present before doing all the tests.

/y