fixing undefined date ranges