Index: pageroute.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pageroute/pageroute.module,v
retrieving revision 1.71.2.12
diff -u -r1.71.2.12 pageroute.module
--- pageroute.module	26 Aug 2009 15:02:34 -0000	1.71.2.12
+++ pageroute.module	10 Sep 2009 13:47:49 -0000
@@ -97,7 +97,7 @@
 /**
  * Gets the form for the current page in the route
  */
-function pageroute_form(&$form_state) {
+function pageroute_form(&$form_state, $prid = NULL, $page_name = NULL, $uid = NULL, $nid = NULL) {
   global $user;
 
   if (!isset($form_state['storage'])) {
@@ -106,13 +106,7 @@
   }
 
   if (!isset($form_state['storage']['route'])) {   // first call
-    $func_args = func_get_args();
-
-    for ($i = func_num_args(); $i <= 4; $i++) {
-      $func_args[$i] = NULL;
-    }
-
-    $route = &pageroute_init_route($func_args[1], $func_args[2], $func_args[3], $func_args[4]);
+    $route = &pageroute_init_route($prid, $page_name, $uid, $nid);
     $form_state['storage']['route'] = &$route;
   }
   else {
@@ -135,7 +129,7 @@
 
   if (isset($form_state['target'])) {
     $route->setSuggestedPage($form_state['target'], $form_state['clicked_button']['#tab-button']);
-    
+
     $uid = isset($args['uid']) ? $args['uid'] : NULL;
     $nid = isset($args['nid']) ? $args['nid'] : NULL;
 
@@ -182,7 +176,6 @@
     $args['hide_pageroute_buttons'] = FALSE;
   }
 
-  
   pageroute_decorate($form, $page, $args['hide_pageroute_buttons']);
 
   $form['#theme_saved'] = isset($form['#theme']) ? $form['#theme'] : array();
@@ -216,10 +209,10 @@
 
   $options = $page->options;
   $button = $form_state['clicked_button'];
-  
+
   $class = get_class($page);
   $info = call_user_func(array($class, 'info'));
-  
+
   if (!isset($button['#tab-button'])) {  // not a tab-like submit button
     switch ($button['#value']) {
       case $options['cancel']:
@@ -560,7 +553,7 @@
   else {
     $options = $page->options;
   }
-  
+
   $form_buttons = array();
 
   foreach (array('back', 'forward') as $key => $name) {
Index: pageroute.route.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pageroute/pageroute.route.inc,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 pageroute.route.inc
--- pageroute.route.inc	26 Aug 2009 15:02:34 -0000	1.1.2.10
+++ pageroute.route.inc	10 Sep 2009 13:47:49 -0000
@@ -9,7 +9,7 @@
  * PagerouteRoute that implements a who Pageroute
  */
 class PagerouteRoute {
-
+  public $args = array();
   public $prid;
   public $options;
   public $pages;
@@ -334,9 +334,9 @@
   /**
    * Remove any unnecessary buttons.
    */
-  public function unsetForm(&$form, $group = '') {  
+  public function unsetForm(&$form, $group = '') {
     if ($group) {
-      $options = $this->options[$group];  
+      $options = $this->options[$group];
     }
     else {
       $options = $this->options;
Index: pageroute.page_edit.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pageroute/pageroute.page_edit.inc,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 pageroute.page_edit.inc
--- pageroute.page_edit.inc	10 Sep 2009 10:09:48 -0000	1.1.2.10
+++ pageroute.page_edit.inc	10 Sep 2009 13:47:49 -0000
@@ -18,9 +18,7 @@
       $args['hide_pageroute_buttons'] = FALSE;
       $args['default_target'] = PAGEROUTE_CURRENT;
 
-      $node = isset($form_state['node']) ? $form_state['node'] : NULL;
-
-      $this->setNodeEditForm($form, $form_state, $this, $args, $node);
+      $this->setNodeEditForm($form, $form_state, $this, $args);
       parent::unsetForm($form);
   }
 
@@ -34,7 +32,9 @@
   public static function setNodeEditForm(&$form, &$form_state, &$page, &$args, $node = NULL) {
 
     if (!$node) {
-      $nid = ($args && isset($args['nid'])) ? $args['nid'] : $page->options['nid'];
+      if ($args && isset($args['nid'])) {
+        $nid = $args['nid'];
+      }
 
       if (empty($nid) && $page->options['content-type']) {
         PageroutePageAdd::setNodeAddForm($form, $form_state, $page);
@@ -55,6 +55,7 @@
     }
 
     if (node_access('update', $node)) {
+      unset($form_state['node']);
       $form += drupal_retrieve_form($type .'_node_form', $form_state, $node);
       drupal_prepare_form($type .'_node_form', $form, $form_state);
     }
@@ -103,7 +104,7 @@
         $todo = array('action' => $form_state['clicked_button']['#value'], 'target' => $target);
         break;
       case t('Save'):
-        $args['default_target'] = PAGEROUTE_FORWARD;
+        $args['default_target'] = PAGEROUTE_CURRENT;
         break;
     }
 
