Fixed the NaN conditional