Fix compilation and a bug in Cache