misc: fix bugs about files and type check