Bug fix; make caching work