diff --git includes/ajax.inc includes/ajax.inc
index 482d0b3..a271f38 100644
--- includes/ajax.inc
+++ includes/ajax.inc
@@ -245,6 +245,9 @@ function ajax_render($commands = array()) {
       }
       // Ensure that the page doesn't reload what it already has.
       $items[$type] = array_diff_key($items[$type], $_POST['ajax_page_state'][$type]);
+      if (empty($items[$type])) {
+        unset($items[$type]);
+      }
     }
   }
 
