Fix when using symlink
More proper support of file type