Add array_filter so the inactive_networks array is stripped from empty array keys.