   ###
   _getImageFromUri: ->
     hash = window.location.hash
-    if hash then toInt hash.replace('#image', '') else 0
+    cid  = 0
+
+    for key, image of @images
+      if "##{image.hashbang}" is hash
+        cid = key
+        break
+
+    cid
 
   ###
    Private method

    cid = ++counter

    data.thumbnail = data.source unless data.thumbnail
    @images[cid]   = data

    @length++


      _this.updateDimensions current.width, current.height if current

    if isStorage and not @thumbnails.hasClass 'choco-hide'
      status = localStorage.getItem('choco-thumbnails') or 1
      @overlay.find('.choco-thumbnails-toggle').trigger 'click' if toInt(status) is 0

    @
