Fix TypeError: cache is undefined