Backport via cache fix from master.