diff --git a/libraries.module b/libraries.module
index 929b8ef..838b764 100644
--- a/libraries.module
+++ b/libraries.module
@@ -720,7 +720,7 @@ function libraries_get_version($library, $options) {
   while ($options['lines'] && $line = fgets($file, $options['cols'])) {
     if (preg_match($options['pattern'], $line, $version)) {
       fclose($file);
-      return $version[1];
+      return $version[0];
     }
     $options['lines']--;
   }
diff --git a/tests/libraries_test.module b/tests/libraries_test.module
index 3ea679a..ac4d9a7 100644
--- a/tests/libraries_test.module
+++ b/tests/libraries_test.module
@@ -340,7 +340,7 @@ function _libraries_test_get_version($library, $file, $pattern, $lines = 20, $co
   while ($lines && $line = fgets($file, $cols)) {
     if (preg_match($pattern, $line, $version)) {
       fclose($file);
-      return $version[1];
+      return $version[0];
     }
     $lines--;
   }
