Fix function lookup in function cache