diff --git a/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module b/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module
index 6a0e6d9..4f6abeb 100644
--- a/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module
+++ b/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module
@@ -145,18 +145,22 @@ function xmlsitemap_node_form_node_form_alter(array &$form, array &$form_state)
  * @return
  *   An array of UNIX timestamp integers.
  */
-function xmlsitemap_node_get_timestamps(stdClass $node) {
+function xmlsitemap_node_get_timestamps($nid) {
   static $timestamps = array();
 
-  if (!isset($timestamps[$node->nid])) {
-    $timestamps[$node->nid] = db_query("SELECT nr.timestamp FROM {node_revision} nr WHERE nr.nid = :nid", array(':nid' => $node->nid))->fetchCol();
+  if (gettype($nid) == 'object') {
+    $nid = $nid->nid;
+  }
+
+  if (!isset($timestamps[$nid])) {
+    $timestamps[$nid] = db_query("SELECT nr.timestamp FROM {node_revision} nr WHERE nr.nid = :nid", array(':nid' => $nid))->fetchCol();
     if (module_exists('comment')) {
-      $comment_timestamps = db_query("SELECT c.created FROM {comment} c WHERE c.nid = :nid AND c.status = :status", array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED))->fetchCol();
-      $timestamps[$node->nid] = array_merge($timestamps[$node->nid], $comment_timestamps);
+      $comment_timestamps = db_query("SELECT c.created FROM {comment} c WHERE c.nid = :nid AND c.status = :status", array(':nid' => $nid, ':status' => COMMENT_PUBLISHED))->fetchCol();
+      $timestamps[$nid] = array_merge($timestamps[$nid], $comment_timestamps);
     }
   }
 
-  return $timestamps[$node->nid];
+  return $timestamps[$nid];
 }
 
 /**
@@ -191,7 +195,7 @@ function xmlsitemap_node_create_link(stdClass $node) {
   );
 
   // Always recalculate changefreq and changecount.
-  $timestamps = xmlsitemap_node_get_timestamps($node);
+  $timestamps = xmlsitemap_node_get_timestamps($node->nid);
   $node->xmlsitemap['changefreq'] = $node->nid ? xmlsitemap_calculate_changefreq($timestamps) : 0;
   $node->xmlsitemap['changecount'] = $node->nid ? count($timestamps) - 1 : 0;
 
