Isn't that reading from the serial port before one knows if there is any thing in the serial buffer (available())?
Serial input basics tutorial.