modify to judge type