Well yeah that is strange ... and lies beyond my expertise. :)
Since I don't know what is happening on the Arduino I can only talk about your P5 program.
So what you want to do here.
Either if you know for certain there should be 3 values, you need to fix the arduino program
else if sometimes you get 2 or 3 or other amounts of values, you need to to condition your program and handle the input
depending on the incoming String.