fixed bugs and implement incremental search(JS-work 4)