Note that f is a global. It evaluates correctly, but not if passed to findPt.
You are right: when I started with a clean kernel, I got what you got.But I found that the following works. Note that g, x, and y are all locals, but passing g works.