     override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
         
-        // Re-enable tollbar items in image preview mode
+        // Re-enable toolbar items in image preview mode
         if [kPiwigoCategorySelectActionMoveAlbum,
             kPiwigoCategorySelectActionSetAlbumThumbnail,
             kPiwigoCategorySelectActionCopyImage,
             kPiwigoCategorySelectActionCopyImages,
             kPiwigoCategorySelectActionMoveImage,
             kPiwigoCategorySelectActionMoveImages].contains(wantedAction) {
-            self.delegate?.didSelectCategory(withId: NSNotFound)
+            self.delegate?.didSelectCategory(withId: selectedCategoryId)
         }
 
         // Unregister palette changes

        }
        
        // Present alert
        self.dismissPiwigoError(withTitle: title, message: message,
                                errorMessage: error) { self.dismiss(animated: true, completion: {}) }
    }
    


    private var inputImageIds: [Int]!
    private var inputImagesData = [PiwigoImageData]()
    private var totalNumberOfImages: Float = 0.0
    private var selectedCategoryId = NSNotFound

    @objc func setInput(parameter:Any, for action:kPiwigoCategorySelectAction) {
        wantedAction = action
