A while back, Dave explained the timing of the cloud registration of Functions&Variables here Case of the Missing Variables (emphasis added):
Unless this has changed - it means you have about 1s on startup before you need to have done the registration. This explains why delay(2000) stopped it from working