--- node_limitnumber.module
+++ node_limitnumber_patched.module  
@@ -129,14 +129,17 @@
 		$account = user_load(array('uid' => $node->uid));
 	}
 
+	if (!$node->nid) {
+		$account = $user;
+	} else {
+		$account = user_load(array('uid' => $node->uid));
+	}
+
 	if (($op == 'prepare' || $op == 'submit')) {
 		$limit = _get_limits_for_user ($account, $node->type);
-
-		if (!empty($limit)) { // We get the total number of nodes of this type owned by this user
-
-			$type_name = node_get_types('name', $node);
-
-			$q = "SELECT * FROM {node} WHERE type = '%s' AND uid = %d";
+  		if (!empty($limit)) { // We get the total number of nodes of this type owned by this user
+ 			$type_name = node_get_types('name', $node);
+   		$q = "SELECT * FROM {node} WHERE type = '%s' AND uid = %d";
 
 
 			$count = db_num_rows(db_query( $q, $node->type, $account->uid));
@@ -146,7 +149,6 @@
 				// This is an attempt to create a new post
 				if ($count >= $limit) {
 					drupal_set_message (t("You have reached the maximum of !limit number of @type items you may post.", array ('!limit' => $limit, '@type' => $type_name)), 'error');
-
 				drupal_goto ('node/add');
 				} else {
 					drupal_set_message (t("This is item !count out of a maximum number of !limit of @type items you may post.", array ('!count' => $count+1, '!limit' => $limit, '@type' => $type_name)),NULL,false);
@@ -155,11 +157,8 @@
 				if($user->uid == $account->uid) {
 					// The user is editing an existing post
 					if ($count >= $limit) {
-						drupal_set_message ('
-<p>' . t("You have reached the maximum of !limit number of @type items you may post.", array ('!limit' => $limit, '@type' => $type_name)) .
-  '</p>
-<p>' . t('You can\'t create any more items of this type, but you can edit this item.') . '</p>
-' );
+						drupal_set_message ('<p>' . t("You have reached the maximum of !limit number of @type items you may post.", array ('!limit' => $limit, '@type' => $type_name)) .
+							'</p><p>' . t('You can\'t create any more items of this type, but you can edit this item.') . '</p>' );
 					} else {
 						drupal_set_message (t("You have created !count out of a maximum number of !limit of @type items you may post.", array ('!count' => $count, '!limit' => $limit, '@type' => $type_name)));
 					}
