--- a/make-linux.mk
+++ b/make-linux.mk
@@ -64,7 +64,8 @@ ifeq ($(ZT_USE_MINIUPNPC),1)
 	DEFS+=-DZT_USE_MINIUPNPC
 
 	# Auto-detect libminiupnpc at least v2.0
-	MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1)
+	#MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' $(STAGING_DIR)/usr/include/miniupnpc/miniupnpc.h && echo 1)
+	MINIUPNPC_IS_NEW_ENOUGH=1
 	ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
 		DEFS+=-DZT_USE_SYSTEM_MINIUPNPC
 		LDLIBS+=-lminiupnpc
@@ -74,7 +75,7 @@ ifeq ($(ZT_USE_MINIUPNPC),1)
 	endif
 
 	# Auto-detect libnatpmp
-	ifeq ($(wildcard /usr/include/natpmp.h),)
+	ifeq ($(wildcard $(STAGING_DIR)/usr/include/natpmp.h),)
 		OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o
 	else
 		LDLIBS+=-lnatpmp
--- a/osdep/PortMapper.cpp
+++ b/osdep/PortMapper.cpp
@@ -180,7 +180,7 @@ public:
 				struct IGDdatas data;
 
 				int upnpError = 0;
-				UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,2,&upnpError);
+				UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,&upnpError);
 				if (devlist) {
 
 #ifdef ZT_PORTMAPPER_TRACE
