diff --git views.module views.module
index c943a3f..e546910 100644
--- views.module
+++ views.module
@@ -179,6 +179,25 @@ function _views_find_module_templates($cache, $path) {
       if ($matches) {
         foreach ($matches as $match) {
           $file = substr($match, 0, strpos($match, '.'));
+          if (substr($path,0,8)=="profiles") {
+            $templatepath=$path;
+          }
+          else {
+            $templatepath=dirname($files[$match]->filename);
+          } 
+          // Put the underscores back in for the hook name and register this pattern.
+          $templates[strtr($file, '-', '_')] = array(
+            'template' => $file,
+            'path' => $templatepath,
+            'variables' => $info['variables'],
+            'base hook' => $hook,
+            'includes' => isset($info['includes']) ? $info['includes'] : NULL,
+          );
+        }
+      }
+      if ($matches) {
+        foreach ($matches as $match) {
+          $file = substr($match, 0, strpos($match, '.'));
           // Put the underscores back in for the hook name and register this pattern.
           $templates[strtr($file, '-', '_')] = array(
             'template' => $file,