automatic detection of filetypes