Added check to see if variables are NaN

Added check to see if variables are NaN