programming error...Need Help!!

From the linked code (the compiler won't complain about this pile of pooh)

 if(Serial.available()>0)
  {
          x[0]=Serial.read();
          x[1]=Serial.read();
          x[2]=Serial.read();
          x[3]=Serial.read();
          x[4]=Serial.read();
          SUM=x[0]+x[1]+x[2]+x[3];
          if(SUM==x[4])