fix bugs and improve search speed by cache