Bug in getting network subnet

It will run into exception of 'KeyError': 0, because it should get 'subnets' first from the dictionary.