add network state checking