add function to wait for network at startup