Fix a bunch of minor issues related to files and filetypes. Fixes #1062.