Roving Networks Wifi Shield not rebooting

Hi,

I bought this wifi shield and Im having issues with it getting stuck every now and then. If I reboot the shield with the reset button, it runs fine again. But I tried rebooting it in code and it doesnt reboot. I added the reboot(); line here in the wifly::open() from the harlequin library at github for WiFlyHQ. The reboot(); line is reached after the wifly module crashes, and the reboot() function logs the message rebooting… but the shield doesnt reboot the way it does with the reset button because it never comes back online. What can be happening?

boolean WiFly::open(const char *addr, uint16_t port, boolean block)
{
    char buf[20];
    char ch;

    ...

    if (!getPrompt()) {
	debug.println(F("Failed to get prompt"));
	debug.println(F("WiFly has crashed and will reboot..."));
	//Add reboot code
	reboot(); //Calls the function but reboot() doesnt take place...why?
	while (1); /* wait for the reboot */
	return false;
    }

   ...

and a debug message in the reboot function here:

/** Reboots the WiFly.
 * @note Depending on the shield, this may also reboot the Arduino.
 */
boolean WiFly::reboot()
{
    debug.println(F("rebooting..."));
    if (!startCommand()) {
	return false;
    }
    send_P(PSTR("reboot\r"));
    if (!match_P(PSTR("*Reboot*"))) {
	finishCommand();
	return false;
    }
    delay(5000);
    inCommandMode = false;
    exitCommand = 0;
    init();
    return true;
}