Fix issues #434 #435 #436 in [[QueryCache]] algorithm