Fix naming collision between locally defined function and variable phi.