If the networking didn't come up well, the 'functions' routines would not be able to handle. Switch to using apiclient which is designed specifically to handle less cooperative initial network conditions.