small flaw in cache checking