refined file type checking