Fixes #146. Avoid using caches that are dirty but use the rest.