fixed bug with caching