Fix filetype detection bug