Fix syntax error in waiting loop for network