server session BUGFIX finding existing ctn entry
diff --git a/src/session_server_tls.c b/src/session_server_tls.c
index 93e8187..a7517c1 100644
--- a/src/session_server_tls.c
+++ b/src/session_server_tls.c
@@ -1172,9 +1172,9 @@
         opts->ctn = new;
     } else {
         for (ctn = opts->ctn; ctn->next && ctn->next->id < id; ctn = ctn->next);
-        if (ctn->next && (ctn->next->id == id)) {
+        if (ctn->id == id) {
             /* it exists already */
-            new = ctn->next;
+            new = ctn;
         } else {
             /* insert after ctn */
             new = calloc(1, sizeof *new);