Fix file guessing to be smarter.