improve file type guessing