[BUGFIX] Possible race condition when creating directory