diff --git a/reply.module b/reply.module
index ed0771e..1513cfd 100644
--- a/reply.module
+++ b/reply.module
@@ -677,8 +677,8 @@ function reply_load_children($id) {
 function reply_get_entity($entity_id, $entity_type, $instance_id) {
   $cache = &drupal_static(__FUNCTION__);
 
-  if (!isset($cache[$entity_type][$entity_type][$instance_id])) {
-    $cache[$entity_type][$entity_type][$instance_id] = db_select('reply', 'r')
+  if (!isset($cache[$entity_type][$entity_id][$instance_id])) {
+    $cache[$entity_type][$entity_id][$instance_id] = db_select('reply', 'r')
       ->fields('r', array('id'))
       ->condition('entity_id', $entity_id)
       ->condition('entity_type', $entity_type)
@@ -686,7 +686,7 @@ function reply_get_entity($entity_id, $entity_type, $instance_id) {
       ->orderBy('position')->execute()->fetchCol();
   }
 
-  return $cache[$entity_type][$entity_type][$instance_id];
+  return $cache[$entity_type][$entity_id][$instance_id];
 }
 
 
