diff --git a/adaptive_image.image.inc b/adaptive_image.image.inc
index 04681a6..4d80fa1 100644
--- a/adaptive_image.image.inc
+++ b/adaptive_image.image.inc
@@ -37,8 +37,13 @@ function adaptive_image_style_deliver($style, $scheme) {
     drupal_exit();
   }
 
-  $style['effects'][1]['data']['width'] = $resolution;
-  $style['effects'][1]['data']['height'] = NULL;
+  foreach ($style['effects'] as $k => $v) {
+    if ($v['name'] == 'adaptive_image') {
+      $style['effects'][$k]['data']['width'] = $resolution;
+      $style['effects'][$k]['data']['height'] = NULL;
+      break;
+    }
+  }
 
   $args = func_get_args();
   array_shift($args);
