fixed timing bug with caching