Added further checks to make sure CACHEs is set