Add some sanity checks to texture cache