corrected detection of filename