diff --git a/faq.test b/faq.test
index ee8505c..fa1bb00 100644
--- a/faq.test
+++ b/faq.test
@@ -112,16 +112,18 @@ class FaqTestCase extends DrupalWebTestCase {
     $this->assertText(t('Add term to @name', array('@name' => $this->taxonomy['name']) ));
 
     $url = parse_url($this->getUrl());
-    if ($url['query'] == '') {
-      $array = split('/', $url['path']);
-      $this->taxonomy['id'] = $array[4];
+    if (isset($url['query'])) {	// Check if query actually exists as this fails if clean urls are enabled
+      if ($url['query'] == '') {
+        $array = split('/', $url['path']);
+        $this->taxonomy['id'] = $array[4];
+      }
+      else {
+        $array = split('/', $url['query']);
+        $this->taxonomy['id'] = $array[3];
+      }
+      $this->pass(var_export($array, TRUE));
     }
-    else {
-      $array = split('/', $url['query']);
-      $this->taxonomy['id'] = $array[3];
-    }
-    $this->pass(var_export($array, TRUE));
-
+    
     $url = $this->getUrl();
     $this->term = array();
     $this->term['name'] = $this->randomName(8);  // Create taxonomy vocabulary name
