Fix cache lookup to use lvars avoiding race