fixed the lock on cache (read and write locks)