Fixed an issue with profiling and caching