diff --git a/autosave.module b/autosave.module
index 1c61c37..76c038e 100644
--- a/autosave.module
+++ b/autosave.module
@@ -192,6 +192,7 @@ function autosave_restore($formid, $timestamp) {
   $record = autosave_get_autosaved_form($form_id, $timestamp, $GLOBALS['user']->uid);
 
   if ($record) {
+    $form_state = unserialize($record->serialized);
     // We need to extract and reuse any additional page arguments that the
     // original form may have.  That's especially true for, say, a node form,
     // which needs the node object passed in as well.
@@ -200,19 +201,6 @@ function autosave_restore($formid, $timestamp) {
       require_once DRUPAL_ROOT . '/' . $menu_item['include_file'];
       $form_state['build_info']['files'][] = $menu_item['include_file'];
     }
-    $form_state['input'] = unserialize($record->serialized);
-
-    // The node_form() form builder expects the first argument to be a full node
-    // object, even when adding a new node. The node/add/[type] menu item only
-    // has a string as its argument, instead of a full object, so we convert it
-    // here for the form.
-    $build_info_args = $menu_item['page_arguments'];
-    if (is_string($build_info_args[0])) {
-      $node = (object) array('type' => $build_info_args[0]);
-      node_object_prepare($node);
-      $build_info_args[0] = $node;
-    }
-    $form_state['build_info']['args'] = $build_info_args;
 
     // Disable the "this form has already been submitted" nonsense by making
     // Drupal think the form is being rebuilt as part of a multi-step form.
@@ -302,13 +290,10 @@ function autosave_restore_access($formid, $timestamp, $form_token) {
  */
 function autosave_save() {
   global $user;
-
-  $path = $_POST['autosave_form_path'];
-  $form_id = $_POST['form_id'];
-  // Not all variables need to be serialized.
-  //    - for Drupal 6 version need to remove op and form_build_id
-  unset($_POST['autosave_form_path'], $_POST['op'], $_POST['form_build_id']);
-  $serialized = serialize($_POST);
+  list($form, $form_state) = ajax_get_form();
+  $path = $form_state['input']['autosave_form_path'];
+  $form_id = $form_state['input']['form_id'];
+  $serialized = serialize($form_state);
 
   // check if node has just been saved - if it has then it's because AS ajax fired off as user was submitting
   // if it had just been submitted - no need to AS now
