Caching: Fixed two bugs