diff --git a/src/app/backend-selection.service.ts b/src/app/backend-selection.service.ts
index 511b98e72250207e60d7948a419da1056e470214..d4f289e3d796b83621bfa88e37a31a94e506fb2f 100644
--- a/src/app/backend-selection.service.ts
+++ b/src/app/backend-selection.service.ts
@@ -51,12 +51,11 @@ export class BackendSelectionService {
       if (this.apiserver.value === null) {
           this.apiservers.subscribe((v) => this.defaultApiServer(v))
       }
-      if (this.apiserver.value.tes.indexOf('localhost') != -1) {
+      if (this.apiserver.value !== undefined && this.apiserver.value !== null && this.apiserver.value.tes.indexOf('localhost') != -1) {
         this.localapi.next(true);
         console.log('localapi true', this.apiserver.value.tes);
       } else {
         this.localapi.next(false);
-        console.log('localapi false',  this.apiserver.value.tes);
       }
     }