Added flag to check whether the network is connected or not