diff --git a/image_class.install b/image_class.install
new file mode 100644
index 0000000..d1daf11
--- /dev/null
+++ b/image_class.install
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * Contains image_class.install
+ */
+
+/**
+ * Implements hook_enable().
+ */
+function image_class_enable() {
+  db_update('system')
+    ->fields(array('weight' => '1000'))
+    ->condition('name', 'image_class')
+    ->execute();
+}
+
+/**
+ * Update a module weight.
+ */
+function image_class_update_7001() {
+  image_class_enable();
+}
diff --git a/image_class.module b/image_class.module
index 052c549..d8ca5f6 100644
--- a/image_class.module
+++ b/image_class.module
@@ -10,21 +10,26 @@
  */
 function image_class_field_formatter_info_alter(&$infos) {
   $infos['image']['settings']['class'] = '';
+  if (module_enable(array('colorbox')) && !empty($infos['colorbox'])) {
+    $infos['colorbox']['settings']['class'] = '';
+  }
 }
 
 /**
  * Implements hook_field_formatter_settings_form_alter().
  */
 function image_class_field_formatter_settings_form_alter(&$settings_form, $context) {
-  $display = $context['instance']['display'][$context['view_mode']];
-  $settings = $display['settings'];
+  if ('image' === $context['field']['type']) {
+    $display = $context['instance']['display'][$context['view_mode']];
+    $settings = $display['settings'];
 
-  $settings_form['class'] = array(
-    '#title' => t('Classes'),
-    '#type' => 'textfield',
-    '#default_value' => $settings['class'],
-    '#description' => t('Enter space seperated classes which will be added to the %img element.', array('%img' => '<img>')),
-  );
+    $settings_form['class'] = array(
+      '#title' => t('Classes'),
+      '#type' => 'textfield',
+      '#default_value' => $settings['class'],
+      '#description' => t('Enter space seperated classes which will be added to the %img element.', array('%img' => '<img>')),
+    );
+  }
 
 }
 
