improve scan directory