(SOLVED) sensor output gets out of sync?

In my main loop I continuously poll 10 touch sensors which works as expected in normal circumstances. However when I rapidly touch a couple at the same time for a few seconds the output gets confused, and doesn't regain sync. For example after it has lost sync I will be touching sensor 3, but my out put will be 4,4,4,4,4... then 3, then if I start touching sensor 4, the output will be 3,3,3,3... 4. Its as if the the data is in a queue? or is there a problem with my code below?

//check button states
for (int i = 0; i < nBtn; i++)
{
	btnState = digitalRead(buttons[i][0]); //buttons[i] = {pin,state}

	if (btnState != buttons[i][1]) //if btn state is different from its recorded state do something
	{
		if (btnState == 1) //if high send the ID
		{
			Serial.write(i);
			buttons[i][1] = 1; //record new state
		}
		else
		{
			buttons[i][1] = 0;
		}
	}
}

There is no queue for the digital pins, you should post the whole code.

So turns out the ''queued' behavior I was experiencing was not on the arduino but rather in my software, and rather obvious now. When rapidly pressing the buttons, I did not receive notifications of data available quickly enough, hence then only reading one byte from the buffer meant a queue built up.

Changing: var val:int = readByte(); to:

while (bytesAvailable) 
{
    var val:int = readByte();
    dispatchEvent(new TouchSensorEvent(TouchSensorEvent.TOUCH_DETECTED, val));
}

fixes the issue.