Several fixes in cache and client (master)