added NaN test for Phi
updated NaN testing framework for Phi
added NaN test for agrad/fwd/Phi