fixed scan bug, search bug