Handle NaN in serialization.