             nextImage.imageIndex = indexOfRemovedImage
             nextImage.imageData = imageData
             nextImage.imageLoaded = false
-//            let nextImage = ImagePreviewViewController()
-//            nextImage.imageLoaded = false
-//            nextImage.imageIndex = indexOfRemovedImage
-//            nextImage.setImageScrollViewWith(imageData)
 
             // This changes the View Controller
             // and calls the presentationIndexForPageViewController datasource method
             pageViewController!.setViewControllers([nextImage], direction: .forward, animated: true) { [unowned self] finished in
-                    // Update image data
-                    self.imageData = self.images[indexOfRemovedImage]
-                    // Re-enable buttons
-                    self.setEnableStateOfButtons(true)
-                }
+                // Update image data
+                self.imageData = self.images[indexOfRemovedImage]
+                // Re-enable buttons
+                self.setEnableStateOfButtons(true)
+                // Reset favorites button
+                // pwg.users.favorites… methods available from Piwigo version 2.10
+                if "2.10.0".compare(NetworkVars.pwgVersion, options: .numeric) == .orderedAscending {
+                    let isFavorite = CategoriesData.sharedInstance()
+                        .category(withId: kPiwigoFavoritesCategoryId, containsImageWithId: imageData.imageId)
+                    setFavoriteBarButton(isFavorite)
+                }
+            }
             return
         }
 

        // Send request to Piwigo server
        ImageUtilities.removeFromFavorites(imageData) {
            DispatchQueue.main.async {
                self.setFavoriteBarButton(false)
            }
        } failure: { error in
            DispatchQueue.main.async {

            prevImage.imageIndex = indexOfRemovedImage - 1
            prevImage.imageData = imageData
            prevImage.imageLoaded = false

            // This changes the View Controller
            // and calls the presentationIndexForPageViewController datasource method
            pageViewController!.setViewControllers( [prevImage], direction: .reverse, animated: true) { [unowned self] finished in
                // Update image data
                self.imageData = self.images[indexOfRemovedImage - 1]
                // Re-enable buttons
                self.setEnableStateOfButtons(true)
                // Reset favorites button
                if "2.10.0".compare(NetworkVars.pwgVersion, options: .numeric) == .orderedAscending {
                    let isFavorite = CategoriesData.sharedInstance()
                        .category(withId: kPiwigoFavoritesCategoryId, containsImageWithId: imageData.imageId)
                    setFavoriteBarButton(isFavorite)
                }
            }
            return
        }
    }
