first lookup and then scan