Seemed to have sorted out NAN errors