Fixed code that detects network adapter