improve file detection