diff --git a/gui/backend.go b/gui/backend.go
index 5feb6d4b481417887a523331b6e487c74d09271a..f8626524a489670a1d00aa59ebe5869b7c54cc35 100644
--- a/gui/backend.go
+++ b/gui/backend.go
@@ -31,10 +31,8 @@ func SwitchOff() {
 }
 
 //export UseLocation
-func UseLocation(label string) {
-	// a bit of a hack to force the compiler to copy the string
-	// so the original C++ string will not be used as it will be changed down the line
-	location := string([]byte(label))
+func UseLocation(label *C.char) {
+	location := C.GoString(label)
 	backend.UseLocation(location)
 }
 
@@ -44,8 +42,9 @@ func UseAutomaticGateway() {
 }
 
 //export SetTransport
-func SetTransport(transport string) {
-	backend.SetTransport(string(transport))
+func SetTransport(transport *C.char) {
+	tp := C.GoString(transport)
+	backend.SetTransport(tp)
 }
 
 //export GetTransport
diff --git a/gui/handlers.cpp b/gui/handlers.cpp
index 47c9025576ab89a7eaf2acf2c0be9255f2577816..bc131520677dcdefc4b34502ed9d125573cbb047 100644
--- a/gui/handlers.cpp
+++ b/gui/handlers.cpp
@@ -48,7 +48,10 @@ void Backend::donateSeen()
 
 void Backend::useLocation(QString label)
 {
-    UseLocation(toGoStr(label));
+    QByteArray loc = label.toUtf8();
+    char *c = loc.data();
+
+    UseLocation(c);
 }
 
 void Backend::useAutomaticGateway()
@@ -58,7 +61,10 @@ void Backend::useAutomaticGateway()
 
 void Backend::setTransport(QString transport)
 {
-    SetTransport(toGoStr(transport));
+    QByteArray tp = transport.toUtf8();
+    char *c = tp.data();
+
+    SetTransport(c);
 }
 
 void Backend::setUDP(bool udp)