diff --git a/gallery_dl/extractor/imagebam.py b/gallery_dl/extractor/imagebam.py
index 6e8379d6..3722d527 100644
--- a/gallery_dl/extractor/imagebam.py
+++ b/gallery_dl/extractor/imagebam.py
@@ -4,8 +4,9 @@ class Extractor(AsyncExtractor):
def __init__(self, match, config):
AsyncExtractor.__init__(self, config)
+ title, key = self.get_title(match)
self.category = "imagebam"
- self.directory = self.get_title(match) + " - " + match.group(2)
+ self.directory = title + " - " + key
def images(self):
next_url = self.url
@@ -35,11 +36,12 @@ class Extractor(AsyncExtractor):
if match.group(1) == "image":
text = self.request(match.group(0)).text
gallery_url, _ = self.extract(text, "class='gallery_title'> ", " <", pos)
self.url, pos = self.extract(text, "