add cache and bug fixed