Fixed a bug in caching sims.