diff --git a/taxonomy_single_tag.module b/taxonomy_single_tag.module
index bae0dea..fbf9a30 100644
--- a/sites/all/modules/taxonomy_single_tag/taxonomy_single_tag.module
+++ b/sites/all/modules/taxonomy_single_tag/taxonomy_single_tag.module
@@ -68,7 +68,8 @@
     '#element_validate' => array('taxonomy_single_tag_autocomplete_validate'),
   );
 
-  return $element;
+  //Return in tid key, so we could replace values in validation stage
+  return array('tid' => $element);
 }
 
 /**
@@ -96,8 +97,11 @@
     // otherwise, create a new 'autocreate' term for insert/update.
     if ($possibilities = taxonomy_term_load_multiple(array(), array('name' => trim($tag), 'vid' => array_keys($vocabularies)))) {
       $term = array_pop($possibilities);
-    }
-    else {
+            
+      //Copy weight from input to element, so they will be sorted. If we don't do it they
+      // won't change delta if weight changed.
+      $term->_weight = $form_state['input'][$element['#field_name']][$element['#language']][$element['#delta']]['_weight'];
+    } else {
       $vocabulary = reset($vocabularies);
       $term = array(
         'tid' => 'autocreate',
@@ -108,6 +112,14 @@
     }
     $value = (array) $term;
   }
+  //Check if $value is empty make it a string, so it won't conflict
+  // with such modules as content taxonomy.
+  if (empty($value)){
+    $value = FALSE;
+  } 
+  //Replace values with normal term objects.
+  $element['#parents'] = array($element['#field_name'], $element['#language'], $element['#delta']);
+  
   form_set_value($element, $value, $form_state);
 }
 