Fix a bug with how the cost of a cache is computed.