diff --git a/src/sbbs3/js_server.c b/src/sbbs3/js_server.c
index de81d138afac15b16f6b857780a24185077b7a86..d5d2ddf80d224d214789df672bd859db290da33d 100644
--- a/src/sbbs3/js_server.c
+++ b/src/sbbs3/js_server.c
@@ -88,7 +88,7 @@ static JSBool js_server_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 			break;
 		case SERVER_PROP_CLIENTS:
 			if(p->clients!=NULL)
-				*vp=UINT_TO_JSVAL(*p->clients);
+				*vp=UINT_TO_JSVAL(protected_uint32_val(*p->clients));
 			break;
 	}
 
diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c
index a6acd01b248479aeee70acdc64bab290c2c7c89f..cccf65eea1fcd53cb107e93eff337cb255ba23e2 100644
--- a/src/sbbs3/mailsrvr.c
+++ b/src/sbbs3/mailsrvr.c
@@ -6021,7 +6021,7 @@ void DLLCALL mail_server(void* arg)
 	ZERO_VAR(js_server_props);
 	SAFEPRINTF3(js_server_props.version,"%s %s%c",server_name, VERSION, REVISION);
 	js_server_props.version_detail=mail_ver();
-	js_server_props.clients=&active_clients.value;
+	js_server_props.clients=&active_clients;
 	js_server_props.options=&startup->options;
 	js_server_props.interfaces=&startup->interfaces;
 
diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 903155d0d51766214e2a488f440d4751bc0d927f..19ec0a412013cc79d5b3cfbb996bc2a20c249784 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -5059,7 +5059,7 @@ void DLLCALL bbs_thread(void* arg)
 	ZERO_VAR(js_server_props);
 	SAFEPRINTF3(js_server_props.version,"%s %s%c",TELNET_SERVER,VERSION,REVISION);
 	js_server_props.version_detail=bbs_ver();
-	js_server_props.clients=&node_threads_running.value;
+	js_server_props.clients=&node_threads_running;
 	js_server_props.options=&startup->options;
 	js_server_props.interfaces=&startup->telnet_interfaces;
 
diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h
index e6011ad2000a654bf63cca254ab2052d06e589f9..aa495d10fd27e0b51442c771aa2590cc47c9c643 100644
--- a/src/sbbs3/sbbs.h
+++ b/src/sbbs3/sbbs.h
@@ -1227,7 +1227,7 @@ extern "C" {
 		const char*	version_detail;
 		str_list_t*	interfaces;
 		uint32_t*	options;
-		uint32_t*	clients;
+		protected_uint32_t*	clients;
 	} js_server_props_t;
 
 	enum {
diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c
index cc51d881d005b73130faccbd46f294aa7d7ca5ee..75f9ef7a839acafb05393942fb42b78d07737e80 100644
--- a/src/sbbs3/websrvr.c
+++ b/src/sbbs3/websrvr.c
@@ -6932,7 +6932,7 @@ void DLLCALL web_server(void* arg)
 	ZERO_VAR(js_server_props);
 	SAFEPRINTF3(js_server_props.version,"%s %s%c",server_name, VERSION, REVISION);
 	js_server_props.version_detail=web_ver();
-	js_server_props.clients=&active_clients.value;
+	js_server_props.clients=&active_clients;
 	js_server_props.options=&startup->options;
 	js_server_props.interfaces=&startup->interfaces;
 
diff --git a/src/xpdev/threadwrap.h b/src/xpdev/threadwrap.h
index 6814aa9fb0a82fb76d32d5ea4bebd5f2d803bed5..9e94e1d1ec9beb138d513e01ab9cccb2958424d6 100644
--- a/src/xpdev/threadwrap.h
+++ b/src/xpdev/threadwrap.h
@@ -41,8 +41,13 @@
 #include "wrapdll.h"	/* DLLEXPORT and DLLCALL */
 
 #ifdef __FreeBSD__
+#include <stdbool.h>
+#ifdef __cplusplus
+#include <atomic>
+#else
 #include <stdatomic.h>
 #endif
+#endif
 
 #if defined(__cplusplus)
 extern "C" {
@@ -153,10 +158,17 @@ DLLEXPORT int DLLCALL pthread_once(pthread_once_t *oc, void (*init)(void));
 /* mutexes.																*/
 /************************************************************************/
 #ifdef __FreeBSD__
+#ifdef __cplusplus
+typedef std::atomic<int32_t> protected_int32_t;
+typedef std::atomic<uint32_t> protected_uint32_t;
+typedef std::atomic<int64_t> protected_int64_t;
+typedef std::atomic<uint64_t> protected_uint64_t;
+#else
 typedef _Atomic(int32_t) protected_int32_t;
 typedef _Atomic(uint32_t) protected_uint32_t;
 typedef _Atomic(int64_t) protected_int64_t;
 typedef _Atomic(uint64_t) protected_uint64_t;
+#endif
 
 DLLEXPORT int DLLCALL protected_uint32_init(protected_uint32_t*,	uint32_t value);
 DLLEXPORT int DLLCALL protected_uint64_init(protected_uint64_t*,	uint64_t value);