diff --git a/ip.module b/ip.module
index 3252f41..bfe3cc3 100755
--- a/ip.module
+++ b/ip.module
@@ -381,19 +381,21 @@ function ip_backlog_nodes() {
  * Handle backlog of comments.
  */
 function ip_backlog_comments() {
-  $result = db_query_range(
-    "SELECT c.cid AS cid, c.hostname AS hostname" .
-    " FROM {comment} c" .
-    " LEFT JOIN {ip_posts} i" .
-    " ON i.type = 'comment'" .
-    " AND (c.cid = i.id OR i.id IS NULL)" .
-    " WHERE i.id IS NULL" .
-    " ORDER BY c.cid DESC",
-    0,
-    50
-  );
-  foreach ($result as $row) {
-    ip_posts_insert('comment', $row->cid, $row->hostname);
+  if (module_exists('comment')) {
+    $result = db_query_range(
+      "SELECT c.cid AS cid, c.hostname AS hostname" .
+      " FROM {comment} c" .
+      " LEFT JOIN {ip_posts} i" .
+      " ON i.type = 'comment'" .
+      " AND (c.cid = i.id OR i.id IS NULL)" .
+      " WHERE i.id IS NULL" .
+      " ORDER BY c.cid DESC",
+      0,
+      50
+    );
+    foreach ($result as $row) {
+      ip_posts_insert('comment', $row->cid, $row->hostname);
+    }
   }
 }
 
@@ -403,4 +405,4 @@ function ip_backlog_comments() {
 // @todo attach our module's data to nodes/comments ?
 // @todo delete from posts table when object (node/comment) is deleted.
 // @todo something like hook_user_operations, but hook_ip_operations
-// @todo handle deleting of comments and nodes.
\ No newline at end of file
+// @todo handle deleting of comments and nodes.
