diff --git a/advagg.module b/advagg.module
index e37aa3c..73753fd 100644
--- a/advagg.module
+++ b/advagg.module
@@ -1464,16 +1464,16 @@ function advagg_build_uri($path) {
   // CDN Support.
   if (module_exists('cdn')) {
     $status = variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED);
-    if (($status == CDN_ENABLED || ($status == CDN_TESTING && user_access(CDN_PERM_ACCESS_TESTING)))) {
+    if ($status == CDN_ENABLED || ($status == CDN_TESTING && user_access(CDN_PERM_ACCESS_TESTING))) {
       // Alter URL when the file_create_url() patch is not there.
       if (variable_get(CDN_THEME_LAYER_FALLBACK_VARIABLE, FALSE)) {
         cdn_file_url_alter($path);
       }
       // Use the patched version of file_create_url().
       else {
-        file_create_url($path);
+       $path = file_create_url($path);
       }
-      if ($original_path != $path) {
+      if (strcmp($original_path, $path) != 0) {
         return $path;
       }
     }
