diff --git a/src/ipxwrapper.c b/src/ipxwrapper.c
index 81bccf0..2398422 100644
--- a/src/ipxwrapper.c
+++ b/src/ipxwrapper.c
@@ -38,7 +38,6 @@
 	}
 
 ipx_socket *sockets = NULL;
-struct ipx_interface *nics = NULL;
 ipx_host *hosts = NULL;
 SOCKET send_fd = -1;
 struct reg_global global_conf;
@@ -79,8 +78,6 @@ BOOL WINAPI DllMain(HINSTANCE me, DWORD why, LPVOID res) {
 			global_conf.filter = 1;
 		}
 		
-		nics = get_interfaces(-1);
-		
 		INIT_CS(&sockets_cs);
 		INIT_CS(&hosts_cs);
 		
@@ -134,8 +131,6 @@ BOOL WINAPI DllMain(HINSTANCE me, DWORD why, LPVOID res) {
 		
 		initialised_cs = 0;
 		
-		free_interfaces(nics);
-		
 		reg_close();
 		
 		unload_dlls();
diff --git a/src/ipxwrapper.h b/src/ipxwrapper.h
index 20bd7eb..b823ca8 100644
--- a/src/ipxwrapper.h
+++ b/src/ipxwrapper.h
@@ -99,7 +99,6 @@ struct ipx_host {
 };
 
 extern ipx_socket *sockets;
-extern struct ipx_interface *nics;
 extern ipx_host *hosts;
 extern SOCKET send_fd;
 extern struct reg_global global_conf;
diff --git a/src/ipxwrapper_stubs.txt b/src/ipxwrapper_stubs.txt
index 771bae2..557e986 100644
--- a/src/ipxwrapper_stubs.txt
+++ b/src/ipxwrapper_stubs.txt
@@ -17,8 +17,8 @@ WSAEventSelect:4
 WSACloseEvent:4
 WSAResetEvent:4
 WSASetEvent:4
-r_EnumProtocolsA:4
-r_EnumProtocolsW:4
+r_EnumProtocolsA:1
+r_EnumProtocolsW:1
 r_WSARecvEx:4
 r_bind:4
 r_closesocket:4
diff --git a/src/winsock.c b/src/winsock.c
index 4f2187d..6ee7ef6 100644
--- a/src/winsock.c
+++ b/src/winsock.c
@@ -420,13 +420,7 @@ int WSAAPI getsockopt(SOCKET fd, int level, int optname, char FAR *optval, int F
 				
 				IPX_ADDRESS_DATA *ipxdata = (IPX_ADDRESS_DATA*)optval;
 				
-				struct ipx_interface *nic = nics;
-				int i = 0;
-				
-				while(nic && i < ipxdata->adapternum) {
-					nic = nic->next;
-					i++;
-				}
+				struct ipx_interface *nic = get_interfaces(ipxdata->adapternum);
 				
 				if(!nic) {
 					WSASetLastError(ERROR_NO_DATA);
@@ -442,6 +436,8 @@ int WSAAPI getsockopt(SOCKET fd, int level, int optname, char FAR *optval, int F
 				ipxdata->maxpkt = MAX_PACKET_SIZE;
 				ipxdata->linkspeed = 100000; /* 10MBps */
 				
+				free_interfaces(nic);
+				
 				RETURN(0);
 			}
 			
@@ -455,12 +451,15 @@ int WSAAPI getsockopt(SOCKET fd, int level, int optname, char FAR *optval, int F
 				
 				*intval = 0;
 				
-				struct ipx_interface *nic = nics;
-				while(nic) {
+				struct ipx_interface *ifaces = get_interfaces(-1), *nic;
+				
+				for(nic = ifaces; nic;) {
 					(*intval)++;
 					nic = nic->next;
 				}
 				
+				free_interfaces(ifaces);
+				
 				RETURN(0);
 			}