diff --git a/lib/s3sync/sync.rb b/lib/s3sync/sync.rb
index <HASH>..<HASH> 100644
--- a/lib/s3sync/sync.rb
+++ b/lib/s3sync/sync.rb
@@ -306,7 +306,9 @@ module S3Sync
         # etag comes back with quotes (obj.etag.inspcet # => "\"abc...def\""
         small_comparator = lambda { obj.etag[/[a-z0-9]+/] }
         node = Node.new(location.path, obj.key, obj.content_length, small_comparator)
-        nodes[node.path] = node
+        # The key is relative path from dir.
+        key = node.path[(dir || "").length,node.path.length - 1]
+        nodes[key] = node
       end
       return nodes
     end
Use relative path for node check key in S3 files.