Added check for non-finite array elements.