fixed a bug in the cache class