diff --git a/check_s3_bucket/__init__.py b/check_s3_bucket/__init__.py
index 6aa6100eaeee67cf9145d7cf6297bed468ac36d9..fbaeaf54c271befe8ab49076e5c23576c376af8e 100755
--- a/check_s3_bucket/__init__.py
+++ b/check_s3_bucket/__init__.py
@@ -134,7 +134,9 @@ def main():
         print("The last but 1 file is empty, can't calculate size difference.")
         exit(3)
 
-    size_ratio = 100 * abs((files[1] - files[0]) / files[1])
+    size_ratio = 100 * abs(
+        (files[1]["Size"] - files[0]["Size"]) / files[1]["Size"]
+    )
     if size_ratio > args.size_critical_threshold:
         print(
             "The size difference between the latest 2 file is {}%.".format(