Fixed thread issue with caching.