Fix a bug will cause the cache never been saved