diff --git a/packages/base/src/lazy-tsp-client.ts b/packages/base/src/lazy-tsp-client.ts
index 78927d0b3..3430a2815 100644
--- a/packages/base/src/lazy-tsp-client.ts
+++ b/packages/base/src/lazy-tsp-client.ts
@@ -15,19 +15,30 @@ export type LazyTspClient = {
 };
 
 export type LazyTspClientFactory = typeof LazyTspClientFactory;
-export function LazyTspClientFactory(url: Promise<string>): ITspClient {
+export function LazyTspClientFactory(provider: () => Promise<string>): ITspClient {
     // All methods from the `HttpTspClient` are asynchronous. The `LazyTspClient`
     // will just delay each call to its methods by first awaiting for the
     // asynchronous `baseUrl` resolution to then get a valid `HttpTspClient`.
-    const tspClientPromise = url.then(baseUrl => new HttpTspClient(baseUrl));
+
+    // Save the current HttpTspClient and the URL used for it.
+    let tspClient: HttpTspClient;
+    let lastUrl: string;
     // eslint-disable-next-line no-null/no-null
     return new Proxy(Object.create(null), {
         get(target, property, _receiver) {
             let method = target[property];
             if (!method) {
                 target[property] = method = async (...args: any[]) => {
-                    const tspClient = (await tspClientPromise) as any;
-                    return tspClient[property](...args);
+                    tspClient = await provider().then(baseUrl => {
+                        // If the url has not been updated keep the same client.
+                        if (lastUrl === baseUrl) {
+                            return tspClient;
+                        }
+                        // If the url has changed save it and create a new client.
+                        lastUrl = baseUrl;
+                        return new HttpTspClient(baseUrl);
+                    });
+                    return (tspClient as any)[property](...args);
                 };
             }
             return method;
diff --git a/theia-extensions/viewer-prototype/src/browser/preferences-frontend-contribution.ts b/theia-extensions/viewer-prototype/src/browser/preferences-frontend-contribution.ts
index d871dc41e..df10de5b8 100644
--- a/theia-extensions/viewer-prototype/src/browser/preferences-frontend-contribution.ts
+++ b/theia-extensions/viewer-prototype/src/browser/preferences-frontend-contribution.ts
@@ -14,9 +14,11 @@ export class PreferencesFrontendContribution implements FrontendApplicationContr
         this.tracePreferences.ready.then(() => {
             this.portPreferenceProxy.onPortPreferenceChanged(this.tracePreferences[TRACE_PORT]);
             this.tracePreferences.onPreferenceChanged(async event => {
-                const newValue = typeof event.newValue === 'string' ? parseInt(event.newValue) : event.newValue;
-                const oldValue = typeof event.oldValue === 'string' ? parseInt(event.oldValue) : event.oldValue;
-                this.portPreferenceProxy.onPortPreferenceChanged(newValue, oldValue, true);
+                if (event.preferenceName === TRACE_PORT) {
+                    const newValue = typeof event.newValue === 'string' ? parseInt(event.newValue) : event.newValue;
+                    const oldValue = typeof event.oldValue === 'string' ? parseInt(event.oldValue) : event.oldValue;
+                    this.portPreferenceProxy.onPortPreferenceChanged(newValue, oldValue, true);
+                }
             });
         });
     }
diff --git a/theia-extensions/viewer-prototype/src/node/viewer-prototype-backend-module.ts b/theia-extensions/viewer-prototype/src/node/viewer-prototype-backend-module.ts
index 366468a13..1f98fe81e 100644
--- a/theia-extensions/viewer-prototype/src/node/viewer-prototype-backend-module.ts
+++ b/theia-extensions/viewer-prototype/src/node/viewer-prototype-backend-module.ts
@@ -45,8 +45,7 @@ export default new ContainerModule(bind => {
                 new JsonRpcConnectionHandler(TRACE_SERVER_CLIENT, () => {
                     const provider = ctx.container.get<TraceServerUrlProvider>(TraceServerUrlProvider);
                     const lazyTspClientFactory = ctx.container.get<LazyTspClientFactory>(LazyTspClientFactory);
-                    const traceServerUrlPromise = provider.getTraceServerUrlPromise();
-                    return lazyTspClientFactory(traceServerUrlPromise);
+                    return lazyTspClientFactory(() => provider.getTraceServerUrlPromise());
                 })
         )
         .inSingletonScope();