There are more robust ways to receive serial data. Robin2's serial input basics tutorial will introduce you to some.