added a try:except: for accessing the cache