Using Xbee S1 to communicate between two arduinos.

  Serial.flush();

Throw away random amounts of unread data (0023 and earlier) or wait until all pending data has been sent (1.0+). Why do you need to do either one?