diff --git a/branding/templates/debian/rules-template b/branding/templates/debian/rules-template
index 686cdd7d3393eee77b266b2bf13d03805f072b8c..9f765ab4285bf1876b13d78cd805143045f9c9fc 100755
--- a/branding/templates/debian/rules-template
+++ b/branding/templates/debian/rules-template
@@ -3,9 +3,24 @@
 
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
+export GO111MODULE=on
+export GOCACHE=/tmp/gocache
 
 export DH_GOPKG = 0xacab.org/leap/bitmask-vpn
-export DH_GOLANG_EXCLUDES = vendor
+export DH_GOLANG_EXCLUDES := vendor packages tools cmd/bitmask-helper cmd/bitmask-connect
+
+#dh_golang doesn't do this for you
+
+ifeq ($(DEB_HOST_ARCH), i386)
+        export GOARCH := 386
+else ifeq ($(DEB_HOST_ARCH), amd64)
+        export GOARCH := amd64
+else ifeq ($(DEB_HOST_ARCH), armhf)
+        export GOARCH := arm
+else ifeq ($(DEB_HOST_ARCH), arm64)
+        export GOARCH := arm64
+endif
+
 
 # TODO get the static version that gen_pkg generated instead??
 VERSION = debian-$(shell git describe --tags --always)
@@ -17,6 +32,7 @@ APPNAME = ${binaryName}
 override_dh_auto_test:
 
 override_dh_auto_build:
+	mkdir -p /tmp/gocache
 	rm -rf src/0xacab.org/leap/bitmask-vpn/tools/transifex
 	rm -rf obj-$(DEB_BUILD_GNU_TYPE)/src/0xacab.org/leap/bitmask-vpn/tools/transifex
 	rm -rf tools
@@ -29,8 +45,6 @@ override_dh_install:
 	cp $(CURDIR)/helpers/se.leap.bitmask.policy   $(CURDIR)/debian/${APPNAME}/usr/share/polkit-1/actions
 	rm -fr $(CURDIR)/debian/${APPNAME}/usr/share/gocode
 	strip $(CURDIR)/debian/${APPNAME}/usr/bin/bitmask-vpn
-	rm $(CURDIR)/debian/${APPNAME}/usr/bin/bitmask-helper
-	rm $(CURDIR)/debian/${APPNAME}/usr/bin/bitmask-connect
 	mv $(CURDIR)/debian/${APPNAME}/usr/bin/bitmask-vpn $(CURDIR)/debian/${APPNAME}/usr/bin/${APPNAME}
 	mkdir -p $(CURDIR)/debian/${APPNAME}/usr/share/${APPNAME}
 	cp $(CURDIR)/debian/icons/scalable/icon.svg $(CURDIR)/debian/${APPNAME}/usr/share/${APPNAME}/icon.svg
diff --git a/branding/templates/makefile/Makefile b/branding/templates/makefile/Makefile
index 2eb731205b57e8fdc1532144a52bb26288551879..42b1482c38e395aba4561e36173fc0f09ae8872d 100755
--- a/branding/templates/makefile/Makefile
+++ b/branding/templates/makefile/Makefile
@@ -97,6 +97,7 @@ pkg_deb:
 	# bitmask-vpn tar.gz should be placed in parent forlder after doing 'make prepare' with the
 	# bitmask-vpn topmost Makefile.
 	@cp ../bitmask-vpn_$(VERSION).tgz build/$(BINNAME)_${DEB_VERSION}.orig.tar.gz
+	@rm -rf build/${BINNAME}_${DEB_VERSION} build/bitmask-vpn_${VERSION}-src
 	@cd build && tar xzf $(BINNAME)_${DEB_VERSION}.orig.tar.gz && mv bitmask-vpn_${VERSION}-src ${BINNAME}_${DEB_VERSION}
 	@cp -r debian/ build/$(BINNAME)_$(DEB_VERSION)/
 	@cd build/$(BINNAME)_$(DEB_VERSION) && debuild -us -uc