Improve filetype recognition