diff --git a/template.php b/template.php
index 8b1b1dc..4e049e4 100644
--- a/template.php
+++ b/template.php
@@ -1044,6 +1044,14 @@ function _zurb_foundation_add_reveals() {
 function zurb_foundation_theme_registry_alter(&$theme_registry) {
   // Add our own preprocess function to entities so we can add default classes
   // to our custom Display Suite layouts.
+
+  try {
+    db_set_active('mymoduleDB');
+    db_query('SELECT COUNT(nid) FROM {node}');
+  }
+  catch (\PDOException $e) {
+    return;
+  }
   $entity_info = entity_get_info();
   foreach ($entity_info as $entity => $info) {
     if (isset($entity_info[$entity]['fieldable']) && $entity_info[$entity]['fieldable']) {
