diff --git a/lib/Command/Classify.php b/lib/Command/Classify.php
index ae4c8fa6..75832e26 100644
--- a/lib/Command/Classify.php
+++ b/lib/Command/Classify.php
@@ -109,16 +109,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
 					MusicnnClassifier::MODEL_NAME => [],
 				];
 				foreach ($this->storageService->getFilesInMount($mount['storage_id'], $mount['override_root'], $models, $lastFileId) as $file) {
-					$i++;
-					$lastFileId = $file['fileid'];
 					// if retry flag is set, skip tagged files
 					if ($input->getOption('retry')) {
 						$fileTags = $this->tagManager->getTagsForFiles([$lastFileId]);
 						// check if processed tag is already in the tags
-						if (in_array($processedTag, $fileTags)) {
+						if (in_array($processedTag, $fileTags[$lastFileId])) {
 							continue;	
 						}
 					}
+					$i++;
+					$lastFileId = $file['fileid'];
 					$queueFile = new QueueFile();
 					$queueFile->setStorageId($mount['storage_id']);
 					$queueFile->setRootId($mount['root_id']);