diff --git a/flickr_imagefield/flickr_imagefield.module b/flickr_imagefield/flickr_imagefield.module
index 94d9a5b..387e597 100644
--- a/flickr_imagefield/flickr_imagefield.module
+++ b/flickr_imagefield/flickr_imagefield.module
@@ -190,7 +190,7 @@ function flickr_imagefield_upload($form, $form_state) {
   // value. This field was added in @see: flickr_imagefield_update_6000().
   foreach ($form_state['values'][$form['#flickr_imagefield']] as $file_info) {
     if (empty($file_info['flickr_imagefield_location'])) {
-      $tags = flickr_imagefield_node_tags($form['#node']);
+      $tags = flickr_imagefield_node_tags($form_state['values']);
       $id = flickr_imagefield_flickr_upload($file_info['filepath'], $file_info['filename'], $tags, $file_info['data']['description']);
       // save the response to the files.flickr_imagefield_location field
       db_query("UPDATE {files} SET flickr_imagefield_location = %d WHERE fid = %d", $id, $file_info['fid']);
@@ -312,9 +312,9 @@ function flickr_imagefield_node_variables($op, $param) {
       break;
     case 'values': // Param is node object
       $variables = array(
-        '[nid]' => $param->nid,
-        '[type]' => $param->type,
-        '[yyyy]' => date('Y', $param->created),
+        '[nid]' => $param['nid'],
+        '[type]' => $param['type'],
+        '[yyyy]' => date('Y', $param['created']),
       );
 
   }
@@ -349,7 +349,14 @@ function flickr_imagefield_node_variables_location($op, $param) {
       /* There are multiple places that the location can come from. 
        * $node->location and $node->field_location (cck) are the typicals.
        */
-      $location = isset($param->location) ? $param->location : isset($param->field_location) ? $param->field_location[0] : FALSE;
+      $location = FALSE;
+      if (!empty($param['locations'])) {
+        $location = $param['locations'][0];
+      }
+      elseif (!empty($param['field_location'])) {
+        $location = $param['field_location'][0];
+      }
+
       if ($location) {
         if (!empty($location['city'])) {
           $variables['[city]'] = flickr_imagefield_cleanstring($location['city']);
