Fix some bugs

Signed-off-by: Hao Liu <hliu@redhat.com>
Add DirState recovery feature

Signed-off-by: Hao Liu <hliu@redhat.com>