Using Fio and xBee digital i/o pins

I my project i am using a Fio to monitor some analog inputs and need to turn on a remote relay when a condition is meet. To the best of my knowledge (read NOOB) the xBee digital i/o pins are not connected to the Fio. As a work around i'm trying to use AT commands to set the pins on the xBee so that the remote xBee pins will get updated with this change and turn on the relay. I put togather the following test and it works but after it changes the i/o pin a couple of time it seems like the Fio locks up? Is there a better way to go about this or is there something i did wronge in the code below?

Please see code in this post: http://arduino.cc/forum/index.php/topic,65086.0.html