diff --git a/lib/tasks/thumbnail.rake b/lib/tasks/thumbnail.rake
index d399bb4f050b90a02a6b469dd87188ca741c7105..3de4c7447b31fa41a62fab654b8e3a4e22c3b6a1 100644
--- a/lib/tasks/thumbnail.rake
+++ b/lib/tasks/thumbnail.rake
@@ -13,7 +13,7 @@ namespace :thumbnail do
 
       begin
         # Get items from dspace (from offset to offset+limit)
-        items_ids = item_database_repository.all_ids(limit,offset)
+        items = item_database_repository.all(limit,offset)
       rescue
         # Sleeps for a while to wait database's recovery
         sleep(30.seconds)
@@ -21,13 +21,13 @@ namespace :thumbnail do
         next
       else
         # Terminate loop if there are no more items to import
-        break if items_ids.empty?
+        break if items.empty?
 
         # Increment offset, to get new items on next iteration
         offset = offset + limit
 
-        items_ids.each do |id|
-          ThumbnailGeneratorWorker.perform_async(id)
+        items.each do |item|
+          ThumbnailGeneratorWorker.perform_async(item.id)
         end
 
       end