Delete funtion "get_doc_type" and correct the code