Great, that actually works. What exactly was the problem? I guess that Mathematica first tried to evaluate h symbolically, which now is not happening.
Thanks a lot.
XYInput is nowhere defined... (use XY instead).
XYInput
XY
You might also want to change the "signature" of h slightly, e.g. to h[inp : {_?NumberQ, _?NumberQ}]:=.... This will enforce that it never be invoked with symbolic parameters.
h
h[inp : {_?NumberQ, _?NumberQ}]:=...