Fix critical bug: not record if root_dir not exists