make caching work -- data structure was declared at wrong scope