Fix missing card instance before extracting code for filenames