Small improvements to filetype diagnosis