Fix cache implementation