diff --git a/simplenews_statistics.install b/simplenews_statistics.install
index 744219b..3d7681a 100644
--- a/simplenews_statistics.install
+++ b/simplenews_statistics.install
@@ -162,4 +162,18 @@ function simplenews_statistics_update_7001() {
   db_add_primary_key('simplenews_statistics_opens', array('email', 'nid', 'timestamp'));
   db_add_index('simplenews_statistics_opens', 'email', array('email'));
   db_add_index('simplenews_statistics_opens', 'nid', array('nid'));
+}
+
+/**
+ * Clear all statitics for deleted nodes
+ */
+function simplenews_statistics_update_7002() {
+  // Remove all statistics for nodes that don't exist anymore
+  // do not use db_delete here as we are using the subquery. Keep the MySQL efficient.
+  $query = 'DELETE FROM {simplenews_statistics} WHERE nid NOT IN (SELECT nid FROM {node})';
+  db_query($query);
+  $query = 'DELETE FROM {simplenews_statistics_clicks} WHERE nid NOT IN (SELECT nid FROM {node})';
+  db_query($query);
+  $query = 'DELETE FROM {simplenews_statistics_opens} WHERE nid NOT IN (SELECT nid FROM {node})';
+  db_query($query);
 }
\ No newline at end of file
diff --git a/simplenews_statistics.module b/simplenews_statistics.module
index 30e0899..9f98464 100644
--- a/simplenews_statistics.module
+++ b/simplenews_statistics.module
@@ -69,6 +69,15 @@ function simplenews_statistics_help($path, $arg) {
 }
 
 /**
+ * Implements hook_node_delete(). 
+ */
+function simplenews_statistics_node_delete($node) {
+  db_delete('simplenews_statistics')->condition('nid', $node->nid);
+  db_delete('simplenews_statistics_clicks')->condition('nid', $node->nid);
+  db_delete('simplenews_statistics_opens')->condition('nid', $node->nid);
+}
+
+/**
  * Gathers the opens.
  */
 function simplenews_statistics_open() {
