diff --git a/jail.module b/jail.module
index daa1198..775217b 100644
--- a/jail.module
+++ b/jail.module
@@ -180,6 +180,9 @@ function theme_jail_formatter($variables) {
     $image['width'] = $item['width'];
     $image['height'] = $item['height'];
   }
+  if (isset($variables['jail_image_style'])) {
+    image_style_transform_dimensions($variables['jail_image_style'], $image);
+  }
 
   $effect = $variables['jail_effect'];
   // Do not output an empty 'title' attribute.
@@ -192,7 +195,12 @@ function theme_jail_formatter($variables) {
   else {
     $url = image_style_url($variables['jail_image_style'], $item['uri']);
   }
-  $output = '<img class="lazy" data-href="' . $url . '" src="' . $placeholder . '"/>';
+
+  $attributes = drupal_attributes($image);
+  $output = '<img class="lazy element-invisible" ' . $attributes  . ' data-href="' . $url . '" src="' . $placeholder . '"/>';
+  if (variable_get('jail_noscript', 0)) {
+    $output .= '<noscript><img src="' . $url . '"></noscript>';
+  }
   if ($variables['path']) {
     $path = $variables['path']['path'];
     $options = $variables['path']['options'];
@@ -200,9 +208,6 @@ function theme_jail_formatter($variables) {
     $options['html'] = TRUE;
     $output = l($output, $path, $options);
   }
-  if (variable_get('jail_noscript', 0)) {
-    $output .= '<noscript><img src="' . $url . '"></noscript>';
-  }
   drupal_add_js(drupal_get_path('module', 'jail') . '/jquery.jail.js');
 
   $loader_image = variable_get('jail_loader', drupal_get_path('module', 'jail') . '/white.gif');
@@ -231,7 +236,7 @@ function theme_jail_formatter($variables) {
   if ($options) {
     $js_options = '{' . implode(', ', $options) . '}';
   }
-  $js = '(function ($) {Drupal.behaviors.jail = { attach: function (context, settings) { $(".lazy").jail(' . $js_options . ');}}})(jQuery);';
+  $js = '(function ($) {Drupal.behaviors.jail = { attach: function (context, settings) { $(".lazy").show().jail(' . $js_options . ');}}})(jQuery);';
 
   // Avoid adding duplicate inline js.
   static $added;
