diff --git a/cmis.api.inc b/cmis.api.inc
index ee884c0..b7bc029 100644
--- a/cmis.api.inc
+++ b/cmis.api.inc
@@ -65,7 +65,7 @@ function cmisapi_getCheckedOutDocs($repositoryId, $options = array()) {
  */
 
 function cmisapi_getObject($repositoryId, $objectId, $options = array()) {
-  return cmis_vendor_invoke('getObjectByPath', $repositoryId, $objectId, $options);
+  return cmis_vendor_invoke('getObject', $repositoryId, $objectId, $options);
 }
 
 function cmisapi_getObjectByPath($repositoryId, $path, $options = array()) {
@@ -104,8 +104,8 @@ function cmisapi_getContentStream($repositoryId, $objectId, $options = array())
   return cmis_vendor_invoke('getContentStream', $repositoryId, $objectId, $options);
 }
 
-function cmisapi_updateProperties($repositoryId, $objectId, $properties = array(), $options = array()) {
-  return cmis_vendor_invoke('updateProperties', $repositoryId, $objectId, $properties, $options);
+function cmisapi_updateProperties($repositoryId, $objectId, $properties = array(), $options = array(), $aspects = array()) {
+  return cmis_vendor_invoke('updateProperties', $repositoryId, $objectId, $properties, $options, $aspects);
 }
 
 function cmisapi_moveObject($repositoryId, $objectId, $targetFolderId, $sourceFolderId = NULL, $options = array()) {
diff --git a/cmis_common/lib/cmis_repository_wrapper.php b/cmis_common/lib/cmis_repository_wrapper.php
index 762663c..dc40313 100644
--- a/cmis_common/lib/cmis_repository_wrapper.php
+++ b/cmis_common/lib/cmis_repository_wrapper.php
@@ -1214,8 +1214,12 @@ xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
         {
             $hash_values = array ();
         }
-        $hash_values["PROPERTIES"] = $properties_xml;
-        $hash_values["SUMMARY"] = CMISService :: getSummaryTemplate();
+        $fixed_hash_values = array(
+          'PROPERTIES' => $properties_xml,
+          'SUMMARY' => CMISService::getSummaryTemplate(),
+        );
+        // Merge the fixes hash values first so that the processing order is correct.
+        $hash_values = array_merge($fixed_hash_values, $hash_values);
         if (!isset ($hash_values['title']))
         {
             $hash_values['title'] = $objectName;
diff --git a/cmis_sync/cmis_sync.drupal.inc b/cmis_sync/cmis_sync.drupal.inc
index a2d47c8..06fa248 100644
--- a/cmis_sync/cmis_sync.drupal.inc
+++ b/cmis_sync/cmis_sync.drupal.inc
@@ -41,7 +41,6 @@ function _cmis_sync_drupal_cmis_update($node, $op) {
         // send updates only if the current node has a CMIS reference id.
         $result = db_query('SELECT cmis_objectId FROM {cmis_sync_node} WHERE nid = :nid', array(':nid' => $node->nid));
         foreach($result as $row) {
-          drupal_set_message(print_r($cmis_object, true));
           try {
             // updating CMIS reference object content stream
             if ($cmis_object->content) {
@@ -160,9 +159,10 @@ function _cmis_sync_drupal_cmis_prepare($node) {
       $fields = field_info_instances('node', $node->type);
       $content_field_name = $sync_map[$node->type]['content_field'];
       if (array_key_exists($content_field_name, $fields)) {
-        if ($fields[$content_field_name]['widget']['type'] == 'filefield') {
-          $content_field = $node->$content_field_name;
-          $cmis_object->properties['content-type'] = $content_field[0]['filemime'];
+        if (in_array($fields[$content_field_name]['widget']['type'], array('image_image', 'file_generic'))) {
+          $items = field_get_items('node', $node, $content_field_name);
+          $file = file_load($items[0]['fid']);
+          $cmis_object->properties['content-type'] = $file->filemime;
         }
       }
     }
@@ -203,55 +203,42 @@ function _cmis_sync_drupal_node_field_value(&$node, $field_name, $field_value =
     if (array_key_exists($field_name, $fields)) {
       $content_field = $node->$field_name;
     
-      switch($fields[$field_name]['widget_type']) {
-        case 'filefield':
+      switch ($fields[$field_name]['widget']['type']) {
+        case 'image_image':
+        case 'file_generic':
           if ($field_value == NULL) {
-            if (realpath($content_field[0]['filepath'])) {
-              $value = file_get_contents($content_field[0]['filepath']);
-            }
+            // Get the file data
+            $items = field_get_items('node', $node, $field_name);
+            $file = file_load($items[0]['fid']);
+            $value = file_get_contents($file->uri); 
           }
           else {
-            if (is_array($content_field) && is_array($content_field[0]) && array_key_exists('filepath', $content_field[0])) {
-              // update Drupal file node on filesystem
-              file_put_contents($content_field[0]['filepath'], $field_value);
+            $items = field_get_items('node', $node, $field_name);
+            if (is_array($items)) {
+              // Update existing file.
+              $file = file_load($items[0]['fid']);
+              if (!empty($file->uri)) {
+                file_put_contents($file->uri, $field_value);
             }
             else {
-              // create Drupal file node on filesystem
-              $file_context = array();
-              if (array_key_exists('file', $context)) {
-                $file_context = $context['file'];  
+                $field_info = field_info_field($field_name);
+                $instance_info = field_info_instance('node', $field_name, $node->type);
+                $path = $field_info['settings']['uri_scheme'] . '://';
+                if (strlen($instance_info['settings']['file_directory']) > 0) {
+                  // Set up and create path if it is not already set up.
+                  $path .= $instance_info['settings']['file_directory'] . '/';
+                  if (!is_dir($path)) {
+                    drupal_mkdir($path, NULL, TRUE);
+                  }
+                }
+                // Add an image.
+                $filename = $path . uniqid('cmis_sync_');
+                $file = file_save_data($field_value, $filename);
+                if ($file) {
+                  $file->display = 1;
+                  $node->{$field_name}[LANGUAGE_NONE][0] = (array)$file;
+                }
               }
-              
-              // merge in defaults
-              $file_context += array(
-                'id' => uniqid('cmis_sync_'),
-                'mime' => 'text/html'
-              );
-              
-              // create file
-              $file_drupal_path = file_directory_path(). '/' .$file_context['id'];
-              file_put_contents($file_drupal_path, $field_value);
-              
-              // create file field
-              $file = new stdClass();
-              $file->filename = basename($file_drupal_path);
-              $file->filepath = $file_drupal_path;
-              $file->filemime = $file_context['mime'];
-              $file->filesize = filesize($file_drupal_path);              
-              $file->status = FILE_STATUS_PERMANENT;
-              $file->timestamp = time();
-              drupal_write_record('files', $file);
-              
-              // create new filefield
-              $node->$field_name = array(array(
-                'fid' => $file->fid,
-                'filename' => $file->filename,
-                'filepath' => $file->filepath,
-                'filesize' => $file->filesize,
-                'filemime' => $file->filemime,
-                'list' => 1,
-              ));
-              
             }
           }
           break;
@@ -274,7 +261,7 @@ function _cmis_sync_drupal_node_field_value(&$node, $field_name, $field_value =
         default:
           throw new CMISException(t('Unsupported sync drupal content field type [@field_type] for field [@field_name]. Please review your configuration.', array(
             '@field_name' => $field_name,
-            '@field_type' => $content_type['fields'][$field_name]['type']
+            '@field_type' => $fields[$field_name]['widget']['type'],
           )));
           break;
       }
