Fix how file endings are detected.