Added detection code for a possible loop.

[FIXED]     An infinite loop might occur if the application does a cloudEnabled without checking cloudAvailable when the ubiquity token is unavailable.