moved to RMS check for nans rather than energy