diff --git a/addtocalendar.info b/addtocalendar.info
index 3318f55..005ec09 100644
--- a/addtocalendar.info
+++ b/addtocalendar.info
@@ -3,6 +3,7 @@ description = 'Add to calendar button to be used for event page.'
 core = 7.x
 dependencies[] = date:date
 dependencies[] = field_formatter_settings:field_formatter_settings
+dependencies[] = token:token
 
 ; Information added by Drupal.org packaging script on 2017-02-03
 version = "7.x-1.0"
diff --git a/addtocalendar.module b/addtocalendar.module
index 3eb1998..6b98474 100644
--- a/addtocalendar.module
+++ b/addtocalendar.module
@@ -173,7 +173,7 @@ function addtocalendar_field_formatter_settings_summary_alter(&$summary, $contex
 function addtocalendar_preprocess_field(&$variables) {
   // Provide an extra variable to the field template when the field uses
   // a formatter of type 'foo_formatter'.
-  if ($variables['element']['#formatter'] == 'date_default') {
+  if (isset($variables['element']['#formatter']) && $variables['element']['#formatter'] == 'date_default') {
     // dsm($variables);
     $entity_type = $variables['element']['#entity_type'];
     $field_name  = $variables['element']['#field_name'];
@@ -190,7 +190,7 @@ function addtocalendar_preprocess_field(&$variables) {
       $settings = $variables['addtocalendar_settings'];
       if ($formatter_settings['addtocalendar_show']) {
         $timeZone = date_default_timezone_get();
-        $date = format_date(strtotime($variables['element']['#object']->field_date['und'][0]['value']), 'custom', 'm/d/Y g:ia');
+        $date = format_date(strtotime($variables['element']['#object']->{$field_name}['und'][0]['value']), 'custom', 'm/d/Y g:ia');
         $build['addtocalendar']['atc_date_start'] = array(
           '#type' => 'html_tag',
           '#tag' => 'var',
@@ -212,7 +212,7 @@ function addtocalendar_preprocess_field(&$variables) {
         foreach ($info as $value) {
           switch ($settings[$value]['field']) {
             case 'token':
-              $class_value = $settings[$value]['tokenized'];
+              $class_value = token_replace($settings[$value]['tokenized'], array('node' => $variables['element']['#object']));
               break;
 
             case 'title':
