Fixing error in filename extraction