fix scan_dir bug

Signed-off-by: Karfield Chen <karfield@126.com>