caching finally works, albeit not very efficient