Fixed some issues with cache layer