Problem with cdf returning nan