Fixed cache clear and quit functions