fixed emit event bug, split search and stream into two functions