diff --git a/src/db/roomstore.ts b/src/db/roomstore.ts
index 158a96a4666916f1bdd20980a16a99783d773ba6..e344e3334889ac9ac2bb40ed976d492ee57e8a1a 100644
--- a/src/db/roomstore.ts
+++ b/src/db/roomstore.ts
@@ -103,15 +103,20 @@ export class DbRoomStore {
      * Matrix room and a remote room counts as one pair.
      * @returns {number} The amount of room pairs as an integer
      */
-    public async countEntries() {
+    public async countEntries(): Promise<number> {
         const row = (await this.db.Get("SELECT COUNT(*) AS count FROM room_entries WHERE matrix_id IS NOT NULL AND remote_id IS NOT NULL")) || {};
 
-        if (typeof row.count !== "number") {
+        let count = row.count;
+        if (typeof count === 'string') {
+            count = Number.parseInt(count);
+        }
+
+        if (typeof count !== "number") {
             log.error("Failed to count room entries");
-            throw Error("Failed to count room entries");
+            throw Error(`Failed to count room entries ${JSON.stringify(row)} AND ${typeof count}`);
         }
 
-        return row.count;
+        return count;
     }
 
     public async upsertEntry(entry: IRoomStoreEntry) {