diff --git a/includes/css.inc b/includes/css.inc
index 8bc4c66..ee11d48 100644
--- a/includes/css.inc
+++ b/includes/css.inc
@@ -284,8 +284,9 @@ function ctools_css_disassemble($css) {
   $disassembled_css = array();
   // Remove comments.
   $css = preg_replace("/\/\*(.*)?\*\//Usi", "", $css);
-  // Split out each statement
-  $statements = preg_split('/[;}]/', $css);
+  // Split out each statement. Match either a right curly brace or a semi-colon
+  // that precedes a left curly brace with no right curly brace separating them.
+  $statements = preg_split('/}|;(?=[^}]*{)/', $css);
 
   // If we have any statements, parse them.
   if (!empty($statements)) {
diff --git a/tests/css.test b/tests/css.test
index 039e975..4a5200c 100644
--- a/tests/css.test
+++ b/tests/css.test
@@ -65,5 +65,17 @@ class CtoolsCssTestCase extends DrupalWebTestCase {
     $font_size = (strpos($filtered, 'font-size:12px;') !== FALSE);
     $color = (strpos($filtered, 'color:blue') !== FALSE);
     $this->assertTrue($font_size && $color, 'Multiple properties are merged.');
+
+    $css = '@import url("other.css");p {color: red;}';
+    $filtered = ctools_css_filter($css);
+    $other_css = (strpos($filtered, 'other.css') === FALSE);
+    $color = (strpos($filtered, 'color:red') !== FALSE);
+    $this->assertTrue($other_css && $color, 'CSS is properly sanitized.');
+
+    $css = ';p {color: red; font-size: 12px;}';
+    $filtered = ctools_css_filter($css);
+    $font_size = (strpos($filtered, 'font-size:12px;') !== FALSE);
+    $color = (strpos($filtered, 'color:red') !== FALSE);
+    $this->assertTrue($font_size && $color, 'Multiple properties are retained.');
   }
 }
