Fix issues when the first value of an array is NaN. (See #148)