optimized a little on sql queries. But cache has some bug.