Change termination condition on memory searh