fixed small bugs with caching