diff --git a/gmusicapi_wrapper/musicmanager.py b/gmusicapi_wrapper/musicmanager.py
index <HASH>..<HASH> 100644
--- a/gmusicapi_wrapper/musicmanager.py
+++ b/gmusicapi_wrapper/musicmanager.py
@@ -169,8 +169,9 @@ class MusicManagerWrapper(_BaseWrapper):
 
 				metadata = mutagen.File(temp.name, easy=True)
 				filepath = template_to_filepath(template, metadata) + '.mp3'
+				dirname = os.path.dirname(filepath)
 
-				if os.path.dirname(filepath):
+				if dirname:
 					try:
 						os.makedirs(dirname)
 					except OSError:
Fix undefined variable ('dirname') in MusicManagerWrapper._download [#<I>]