Made the setting of cache more resilient.