fixed the caching problem properly