         else
           self.nbNewPosts = parsed['posts-total'] - total
 
-        self.total = total = parsed['posts-total']
+        # We do not set local variable 'total' which will remain set to its
+        # initial value. This will be used later for sub array find.
+        self.total = parsed['posts-total']
 
       parsed.posts.forEach (post) ->
         photoUrl = post['photo-url-1280']

        # consequence of cache db tampering, this check, if enforced (opt in),
        # will throw an ApiError, meaning we can retry.
        if options.check and self.nbNewPosts isnt newPosts.length
          Q.reject new ApiError "BUG ? #{self.nbNewPosts} new posts but we got #{newPosts.length}"
        else
          # Prepend new posts (newest first like the API)
          self.posts = Array::concat.call [], newPosts, self.posts

# TumblRip -- Download photos from Tumblr
# Made by Olivier ORABONA
# Licence: MIT

# NodeJS imports
fs = require 'fs'
