Fix calculating file name when name is blank